my @keys_sorted_by_value = map { $_->[1] } sort { $a->[0] <=> $b->[0] } map { $hash{$_}, $_ } keys %hash;