If all of the values are numeric you should change the comparison operator to <=> like so:print "$value -> $key\n";
foreach my $key (sort { $HoH{0}{$a} <=> $HoH{0}{$b} } keys %{$HoH{0}} +) { my $value = $HoH{0}{$key}; print "$value -> $key\n"; }
In reply to Re: Sorting hash of hashes by values
by tangent
in thread Sorting hash of hashes by values
by winnie_pooh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |