alienhuman has asked for the wisdom of the Perl Monks concerning the following question:
Monks,
I've got two AoHs, and each hash shares a key, like so:
#!/usr/bin/perl use strict; use Data::Dumper; my @a = ({ domain => 'adomain.com', data => 'adata', }, { domain => 'bdomain.com', data => 'bdata', }); my @b = ({ domain => 'adomain.com', otherdata => 'astuff', }, { domain => 'bdomain.com', otherdata => 'bstuff', });
I want to end up with a single AoH that looks like this:
@c = ({ domain => 'adomain.com', otherdata => 'astuff', data => 'adata', }, { domain => 'bdomain.com', otherdata => 'bstuff', data => 'bdata', });
Just can't get my head around how to do this...
AH
Using perl 5.8.1-RC3 unless otherwise noted. Apache/1.3.33 (Darwin) unless otherwise noted. Mac OS X 10.3.9 unless otherwise noted.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: combine two AoHs
by diotalevi (Canon) on Mar 06, 2006 at 22:37 UTC | |
|
Re: combine two AoHs
by ambrus (Abbot) on Mar 06, 2006 at 22:28 UTC | |
by alienhuman (Pilgrim) on Mar 07, 2006 at 01:18 UTC | |
|
Re: combine two AoHs
by GrandFather (Saint) on Mar 06, 2006 at 22:51 UTC |