in reply to how do i sort hash values?

You can acces hash values only via the keys, so you must sort them, comparing the values to have the values nicely lined up:
my %hash = (f => 'd', c => 'a', b => 'e'); my @keys_ordered_by_value = sort { $hash{$a} cmp $hash{$b} } keys %has +h; # ^^^ # \|/ # to sort numeric values use <=> here -------+ # to sort in reverse order swap $a and $b: { $hash{$a} cmp $hash{$b} + } foreach my $key (@keys_ordered_by_value) { print "key = $key, value = $hash{$key}\n"; }
This is a FAQ. See perlfaq4.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}