take out the spaces @sorted = {$a->[2] <=> $b->[2]} @AoA but this gives a "cannot ^ ^ No spaces should be here
> -----Original Message----- > From: Richard Adams [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 06, 2002 10:18 AM > To: [EMAIL PROTECTED] > Subject: Sorting problem > > > Hello, > I've got an array of arrays, and want to sort by the 3rd > element of the > subarray. I then want to print out the sorted array, showing > the index and > values. E.g., > > @AoA = ( > [23.56, 65.2, 12.4], > [13, 56, 87], > [45,876, 23], > etc > ) > > > And then the printout should look like: > 1: 87 > 2: 23 > 3: 12.4 > > I've tried > @sorted = {$a ->[2] <=> $b ->[2]} @AoA but this gives a "cannot > modify.."error. > I've a feeling this is really trivial but have got abit > bogged down with > it... > Thanks in advance > Richard > > -- > Dr Richard Adams > Chromosome Structure Group > > University of Edinburgh > Kings Buildings, > Mayfield Rd, > Edinburgh > EH9 3JR UK > > > Email [EMAIL PROTECTED] > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]