in reply to How do I record in what order a sort was preformed
my @sorted_indices = sort { $array[$a] <=> $array[$b] } (0..$#array); # If you need to get back the sorted array, use this # without the extra sort step. my @sorted_array = map { $array[$_] } @sorted_indices;
Update fixed slight problem in first line of code
-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: How do I record in what order a sort was preformed
by tye (Sage) on Jan 18, 2002 at 10:49 UTC |