in reply to Re^2: perl sort issue while going through article at perl.com
in thread perl sort issue while going through article at perl.com
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}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: perl sort issue while going through article at perl.com
by convenientstore (Pilgrim) on Oct 22, 2007 at 14:55 UTC | |
|
Re^4: perl sort issue while going through article at perl.com
by convenientstore (Pilgrim) on Oct 23, 2007 at 00:30 UTC | |
by shmem (Chancellor) on Oct 23, 2007 at 05:51 UTC | |
by convenientstore (Pilgrim) on Oct 23, 2007 at 22:14 UTC | |
by FunkyMonk (Bishop) on Oct 23, 2007 at 22:57 UTC | |
by convenientstore (Pilgrim) on Oct 24, 2007 at 00:46 UTC |