foreach ($ref) { $hist{$_}++ for $_; }
Your $ref is a hash reference - use keys:
for ( keys %$ref) { ... }
Since your data structure is a HoH, inside that loop $_ is, again, a hash reference. Again you need keys.
$hist{$_}++ for keys %$_;
But such usage of $_ is a bit obfuscated. Better say
for my $hashref ( keys %$ref) { $hist{$_}++ for keys %$hashref; }
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re^3: perl sort issue while going through article at perl.com
by shmem
in thread perl sort issue while going through article at perl.com
by convenientstore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |