develooper Front page | perl.beginners | Postings from April 2008

Joining/Merging AoA

Thread Previous | Thread Next
From:
Vishal G
Date:
April 22, 2008 08:46
Subject:
Joining/Merging AoA
Hi Guys,

I have a little complicated problem...

I have two arrays

@a = ( ['id', 'name', 'age'],
           ['1', 'Fred', '24'],
           ['2', 'Frank', '42'],
         );

@b = ( ['id', 'sex'],
           ['1', 'm' ],
           ['2', 'm'],
         );

I want to join these two AoA, based on id, so the resulting array will
look like this

@c = ( ['id', 'name', 'age', 'sex'],
           ['1', 'Fred', '24', 'm' ],
           ['2', 'Frank', '42', 'm'],
         );

Any Ideas?

Thanks in advance.


Thread Previous | Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About