At 16.57 +0200 98-08-21, Mark Manning/Muniz Eng. wrote: >> Probably not. This is just an alternative way of sorting, where you sort >> the array indices and then rearrange the array by taking a same-length >> slice of it. > >That is very strange. :-) I had never heard of that before. What I >thought was happening was that it would sort the numbers between zero >and $#id. Which meant that they would go 0, 1, 2, 3, etc.... Perl is >weirder than I thought! :-) If you say sort 0..$#ids you will get the numbers 0, 1, 2, 3, etc in ascending order, and hence get them in the order they were from the beginning. However, if you say sort byID 0..$#ids the order depends on the byID sorting subrouitine. In Nathaniel's code, byID was: sub byID { $ids[$a] <=> $ids[$b]; } This thing compares not the numbers themselves, but elements in @ids array. If $ids[1] < $ids[0], 1 will come before 0 in the array that is sorted this way. Any clearer? Cajo. ___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