William H. Asquith <asquith@macconnect.com> wrote: >2) Desperately seeking help on sorting. How do I sort one array AND >reshuffle one or more other arrays along with the sorted array? How do I >sort a multidimensional array on a single index? I've read up on sort >through the Perl books and can't figure this one out. I could mimic some >numerical recipes in FORTRAN but want to do it the Perl Way. #!perl @one_array = qw(7 5 6 4 1 2 8 3); @another_array = qw(g e f d a b h c); @indeces = sort {$one_array[$a] <=> $one_array[$b]} (0 .. $#one_array); @one_array = @one_array[@indeces]; @another_array = @another_array[@indeces]; print "One array: ", join(', ', @one_array), "\n"; print "Another array: ", join(', ', @another_array), "\n"; __END__ One array: 1, 2, 3, 4, 5, 6, 7, 8 Another array: a, b, c, d, e, f, g, h ___Carl_Johan_Berglund_________________________ Adverb Information carl.johan.berglund@adverb.se http://www.adverb.se/ ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch