What does length(%HASH) produce if you have thirty-seven random keys in a newly created hash?
Perl Questions and Answers
(Continued from previous question...)
What does length(%HASH) produce if you have thirty-seven
random keys in a newly created hash?
5
length() is a built-in prototyped as sub length($),
and a scalar prototype silently changes aggregates into
radically different forms. The scalar sense of a hash is
false (0) if it's empty, otherwise it's a string representing
the fullness of the buckets, like "18/32" or "39/64".
The length of that string is likely to be 5. Likewise,
`length(@a)' would be 2 if there were 37 elements in @a.
(Continued on next question...)
Other Interview Questions
|