my @keys = sort { $hash{$b} <=> $hash{$a} } keys %hash; foreach my $key (@keys) {print "$key\t$hash{$key}\n";}