Re: Sorting problem-part2

2002-05-06 Thread Michael Lamertz
Took me some time, but... On Mon, May 06, 2002 at 04:41:03PM +0100, Richard Adams wrote: > Now I've got an array of hashes, where each hash can have different keys > e.g., > > @aoh = ( {H3 =>234, H1 =>127, DNA =>1, p135 =>167}, > {H4=>24, H3=>1550, DNA =>25, p39 =>67}, >

Re: Sorting problem-part2

2002-05-06 Thread Michael Lamertz
On Mon, May 06, 2002 at 12:22:15PM -0400, David Gray wrote: > > Now I've got an array of hashes, where each hash can have > > different keys e.g., > > > > @aoh = ( {H3 =>234, H1 =>127, DNA =>1, p135 =>167}, > > {H4=>24, H3=>1550, DNA =>25, p39 =>67}, > > {H3 =>34, H2A =

RE: Sorting problem-part2

2002-05-06 Thread David Gray
> Now I've got an array of hashes, where each hash can have > different keys e.g., > > @aoh = ( {H3 =>234, H1 =>127, DNA =>1, p135 =>167}, > {H4=>24, H3=>1550, DNA =>25, p39 =>67}, > {H3 =>34, H2A =>125, DNA =>5, p32 =>7}, > {H3 =>24, H4 =>156, DNA =>123, p1

Re: Sorting problem-part2

2002-05-06 Thread Richard Adams
Now I've got an array of hashes, where each hash can have different keys e.g., @aoh = ( {H3 =>234, H1 =>127, DNA =>1, p135 =>167}, {H4=>24, H3=>1550, DNA =>25, p39 =>67}, {H3 =>34, H2A =>125, DNA =>5, p32 =>7}, {H3 =>24, H4 =>156, DNA =>123, p12 =>13} )

Re: Sorting problem

2002-05-06 Thread Richard Adams
Thanks for all your help...I just forgot the sort in my post... The reason it wasn't working wasn't the sort, it was just that $AoA[0] was undefined.. But sort {$a->[2] <=> $b->[2]} @AoA[1..$#AoA] works just fine. Thanks again! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comman

Re: Sorting problem

2002-05-06 Thread Michael Lamertz
On Mon, May 06, 2002 at 03:17:39PM +0100, Richard Adams wrote: > 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., Hmm, works for me with the exception of... > I've tried

Re: Sorting problem

2002-05-06 Thread Felix Geerinckx
on Mon, 06 May 2002 14:17:39 GMT, [EMAIL PROTECTED] (Richard Adams) wrote: [Please don't retype code - cut and paste instead] > I've tried > @sorted = {$a ->[2] <=> $b ->[2]} @AoA You forgot the 'sort' function. You put spaces before the '->'. You got the sort order reversed. Try

RE: Sorting problem

2002-05-06 Thread Bob Showalter
> -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 t

RE: Sorting problem

2002-05-06 Thread Nikola Janceski
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] > S