$rank[ $data{$_} ] .= "$_\n" for sort keys %data; defined and $n += print s/^/$n - /gmr for reverse @rank;
Clever as always :-) It should be noted, however, that memory usage (and speed) gets worse for increasingly large values in the hash, since it causes @rank to grow accordingly.
In reply to Re^2: Sorting and ranking
by haukex
in thread Sorting and ranking
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |