CARVIEW |
- #length EXPR
- #length
-
Returns the length in characters of the value of EXPR. If EXPR is omitted, returns the length of
$_
. If EXPR is undefined, returnsundef
.This function cannot be used on an entire array or hash to find out how many elements these have. For that, use
scalar @array
andscalar keys %hash
, respectively.Like all Perl character operations,
length
normally deals in logical characters, not physical bytes. For how many bytes a string encoded as UTF-8 would take up, uselength(Encode::encode('UTF-8', EXPR))
(you'll have touse Encode
first). See Encode and perlunicode.
Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via the GitHub issue tracker or email regarding any issues with the site itself, search, or rendering of documentation.
The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the Perl issue tracker, the mailing list, or IRC to report any issues with the contents or format of the documentation.