This function cannot be used on an entire array or hash to find out how many elements these have. For that, use
scalar @array and
scalar 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, use
length(Encode::encode('UTF-8', EXPR)) (you'll have to
use Encode first). See Encode and perlunicode.