key_val(%whatever_hash_name_you_want_); sub key_val { my %hash = shift; map {print "$_ - $hash{$_} \n";} sort{$hash{$a} cmp $hash{$b}} keys %hash; }