jkva has asked for the wisdom of the Perl Monks concerning the following question:
Esteemed Monks.
Let's say I have two hashes :%hash1 = ( foo => 'bar', baz => { quux => 'qwe', rty => 'uiop', }, perl => ['monks', 'monastery', 'robes'], ) %hash2 = ( wizardry => 'hocus-pocus', foo => 'f00', baz => { grail => 'arthur', }, perl => ['yayy', 'yippee'], hash3 => {key1 => 'value1', key2 => 'value2', }, );
I'd like to "add" %hash2 to %hash1, and existing data should be overwritten while nonexistent data should be added. What would be the best approach to this?
-- jkva
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Combining / Merging two Ho(H|A)s
by GrandFather (Saint) on Feb 21, 2006 at 21:02 UTC | |
Re: Combining / Merging two Ho(H|A)s
by Roy Johnson (Monsignor) on Feb 21, 2006 at 21:35 UTC | |
Re: Combining / Merging two Ho(H|A)s
by jdporter (Paladin) on Feb 21, 2006 at 23:22 UTC | |
by jkva (Chaplain) on Feb 22, 2006 at 05:41 UTC | |
by jdporter (Paladin) on Feb 22, 2006 at 13:54 UTC | |
Re: Combining / Merging two Ho(H|A)s
by ikegami (Patriarch) on Feb 21, 2006 at 21:14 UTC | |
Re: Combining / Merging two Ho(H|A)s
by Corion (Patriarch) on Feb 21, 2006 at 21:02 UTC | |
Re: Combining / Merging two Ho(H|A)s
by xorl (Deacon) on Feb 21, 2006 at 20:59 UTC | |
by jkva (Chaplain) on Feb 21, 2006 at 21:02 UTC |
Back to
Seekers of Perl Wisdom