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.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Replies are listed 'Best First'.
Re^2: Crazy hash sorting issue.
by rementis (Beadle) on Nov 04, 2005 at 20:56 UTC
    This sorts based on keys instead of values, no need to use split commands as the keys do not contain any dashes.