in reply to RE: Simple sorting by another parallel array
in thread Simple sorting by another parallel array
You mean this?
my @sorted_names= @names[ my @idx= sort {$ages[$a]<=>$ages[$b]} 0..$#ages ]; my @sorted_ages= @ages[@idx];
This is much more efficient than sorting by age all over again.
Update: Fixed my typo.
- tye (but my friends call me "Tye")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: RE: Simple sorting by another parallel array
by extremely (Priest) on Sep 25, 2000 at 00:11 UTC |