in reply to
Re^2: Sort hash with values
in thread Sort hash with values
The only change i have done is reversing the hash.
A naive hash reversal works just fine if the hash values are unique to begin with. If they're not, somebody's gonna get (silently) clobbered. Maybe add a pre/post reversal size check:
>perl -wMstrict -le
"my %hash = qw(a aye b bee c see eh aye);
my $pre_k = keys %hash;
%hash = reverse %hash;
$pre_k == keys %hash or die 'somebody got clobbered';
somebody got clobbered at -e line 1.