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