in reply to reusable hash value sort

i'm not really sure what you mean, but here goes:
sub sortByValue { my %hash = @_; sort { $a->[1] cmp $b->[1] } map { [ $_, %hash{$_} ] } keys %hash; } foreach $pair (sortByBalue %myHash) { print "$pair->[0] - $pair->[1]\n"; }
or, if sortByValue should return only the keys:
sub sortByValue { my %hash = @_; sort { $hash{$a} cmp $hash{$b} } keys %hash; } foreach my $key (sortByValue %myHash) { print "$key - $myHash{$key}\n"; }
the fun thing to do would be to tie a hash table to return it's keys sorted based on the values for the each function. (i'd bet my left pinky this exists already on CPAN)