in reply to Want to sort hashes by values, anyone?

Doraemon,
There are several modules on CPAN that will do this for you. I have included one example.
#!/usr/bin/perl use strict; use warnings; use Tie::Hash::Sorted; my $sort_by_value = sub { my $hash = shift; [ sort {$hash->{$b} cmp $hash->{$a}} keys %$hash ]; } tie my %sorted_hash, 'Tie::Hash::Sorted', 'Sort_Routine' => $sort_by_v +alue; %sorted_hash = (k1=> 'v2', k2=> 'v1'); print "$_ : $sorted_hash{$_}\n" for keys %sorted_hash;
Cheers - L~R