in reply to Re: Data::Sorting
in thread Data::Sorting
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^2: Data::Sorting (fast)
by BrowserUk (Patriarch) on May 27, 2004 at 18:16 UTC |