foreach ( sort {$b <=> $a} keys %hash ){ print $_," ",$hash{$_},"\n"; }