In Perl, I want to sort the keys of a hash by value, numerically:
{ five => 5 ten => 10 one => 1 four => 4 }
producing
my ( @nums, @words ); do { push @nums, shift @$_; push @words, shift @$_; } foreach sort { $a->[0] <=> $b->[0] } map { [ $h->{ $_ }, $_ ] } keys %$h ;