It would be much more useful, or sensible, if hash in a scalar context returned the number of keys:As soon as you try to use it as a number, "2/8" will be numified to 2 so actually it does effectively return the number keys.
The number of buckets is some bonus info for free.perl -le '%h = (a =>1, b => 2); print %h+0' 2
In reply to Re^2: Perl oddities
by fergal
in thread Perl oddities
by brian_d_foy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |