in reply to Crazy hash sorting issue.
my @keys = sort { my @a = split '-', $tapes{$a}; my @b = split '-', $tapes{$b}; $a[-1] cmp $b[-1] } keys %tapes; foreach my $k (@keys) { print "$k $tapes{$k}\n"; }
However, I wouldn't put that code into production without understanding what it does. I urge you to ask questions, which I'll gladly answer.
Update:Fixed keys/values conflation.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Crazy hash sorting issue.
by rementis (Beadle) on Nov 04, 2005 at 20:56 UTC |