in reply to How do I sort a hash by its values?

Read perlman:perlfaq4, "How do I sort a hash (optionally by value instead of key)?"

But in short:

@keys = sort { $hash{$b} <=> $hash{$a} } keys %hash;
@keys now contains the sorted list of keys.