in reply to Data::Sorting

Sorry, I've never looked at Data::Sorting but I don't think you really need it. You could just use something like this:

@sorted_keys = sort { $hash{$a}[0] cmp $hash{$b}[0] || $hash{$a}[1] cmp $hash{$b}[1] || $hash{$a}[2] cmp $hash{$b}[2] } keys %hash;

Replies are listed 'Best First'.
Re^2: Data::Sorting (fast)
by tye (Sage) on May 27, 2004 at 17:19 UTC

    And if you have a lot of data and you want the sorting to be fast, you can use:

    my @sortedKeys= map { ( split /\0/, $_ )[-1] } sort map { join "\0", @{$hash{$_}}[0,1,2], $_ } keys %hash;

    assuming no "\0" characters in your keys and values (often a pretty safe bet).

    - tye        

    Updated to replace original line

    map { join "\0", $hash{$_}[0,1,2], $_ }

    with corrected line. Thanks, BrowserUk.

      Don't you need to dereference the hash value to get the array slice to work?

      map { join "\0", @{ $hash{$_} }[0,1,2], $_ }

      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail