home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


3.2.84 length

length 

EXPR

This function returns the length in bytes of the scalar value EXPR . If EXPR is omitted, the function returns the length of $_ , but be careful that the next thing doesn't look like the start of an EXPR , or the tokener will get confused. When in doubt, always put in parentheses.

Do not try to use length to find the size of an array or hash. Use scalar @array for the size of an array, and scalar keys %hash for the size of a hash. (The scalar is typically dropped when redundant, which is typical.)