To expand on ant9000's answer, his function will help in making a comparison tag. He's building a string which has all the numbers in fixed-width columns so that the string comparison operator will naturally order according to numerical fields. To use it to sort by those tags, you'd apply the schwartzian transform:
my @keys_sorted_by_converted_value = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [ $_, fmt($hash{$_}) ] } keys %hash;
--
[ e d @ h a l l e y . c c ]
In reply to Re: Re: sort hash by value
by halley
in thread sort hash by value
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |