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},
>
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 =
> 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
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}
)
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
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
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
> -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
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