The OP doesn't state this clearly, but I assume that he means numerically sorted, rather than lexically.
print "$_\t$hash{$_}\n" for reverse sort { $a <=> $b } keys %hash; # or simply print "$_\t$hash{$_}\n" for sort { $b <=> $a } keys %hash;
In reply to Re^2: sorting a hash
by fishbot_v2
in thread sorting a hash
by Lhamo_rin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |