August 1999 Return to the Perl Hardware Store Slide #4

The Indirect Sort

        0         1        2           3     4           5
        Albert    Mark     Morton      Babe  Nat         Larry
        Einstein  Dominus  Zeemeister  Ruth  Torkington  Wall
        @indices = sort {$last[$a] cmp $last[$b]} (0 .. $#last);
        @sorted = @first[@indices];


Next Copyright © 1999 M-J. Dominus