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