http://www.perlmonks.org?node_id=1028454


in reply to Re^2: Hash of hashes assignment
in thread Hash of hashes assignment

The "2/8" of a hash in scalar context is just a representation of the number of "buckets" used/assigned for the hash. Note that more than one key can be assigned to the same "bucket" depending on how the hashing algorith works on the keys involved and that keys can be redistributed when more "buckets" are assigned as the hash grows.

$ perl -Mstrict -Mwarnings -E ' > my %hash; > say scalar %hash; > for ( q{a} .. q{z} ) > { > $hash{ $_ } = 1; > say qq{$_ - @{ [ scalar %hash ] }}; > }' 0 a - 1/8 b - 2/8 c - 3/8 d - 4/8 e - 5/8 f - 6/8 g - 6/8 h - 7/16 i - 8/16 j - 9/16 k - 9/16 l - 10/16 m - 10/16 n - 11/16 o - 11/16 p - 14/32 q - 14/32 r - 14/32 s - 15/32 t - 15/32 u - 16/32 v - 16/32 w - 17/32 x - 17/32 y - 18/32 z - 19/32 $

I hope this is helpful.

Cheers,

JohnGG