B
Brett
I have two arrays and i wish to sort the first one numerically, but after
sorting, I would like the second array to be in the same matching order as
the first array.
ie.
@l1={3,1,2};
@l2={'a','b','c'};
@l1 = sort {$a <=> $b} (@l1); # sort list @l1 to be {1,2,3}
# do something to @l2 to make order {'b','c','a'} (preserving the original
mapping with the first list)
There's probably an easy way to do this that i'm not aware of.
Thanks in advance,
Brett.
sorting, I would like the second array to be in the same matching order as
the first array.
ie.
@l1={3,1,2};
@l2={'a','b','c'};
@l1 = sort {$a <=> $b} (@l1); # sort list @l1 to be {1,2,3}
# do something to @l2 to make order {'b','c','a'} (preserving the original
mapping with the first list)
There's probably an easy way to do this that i'm not aware of.
Thanks in advance,
Brett.