my %hash = (value1 => 345, value2 => 132, value3 => 1, value4 => 12, value5=>978); my (@keys,$key); @keys = sort { $hash{$a} <=> $hash{$b} } keys %hash; foreach $key (@keys) { print "$key: $hash{$key}\n"; }