http://www.perlmonks.org?node_id=533333


in reply to sorting a hash

From your expected output you probably meant sorting the keys and not the values of the hash.

foreach ( sort {$b <=> $a} keys %hash ){ print $_," ",$hash{$_},"\n"; }
should answer your question (decending numeric key sorting).

Enjoy,
Mickey