Sami_R has asked for the wisdom of the Perl Monks concerning the following question:
Have two hashes, need to combine two hashes into single hash.
my $VAR1 = { 'Tim' => { 'abc' => 7, 'def' => 7, 'ghi' => 0 }, 'Adam' => { 'abc' => 0, 'def' => 0, 'ghi' => 0 }, 'keas' => { 'abc' => 0, 'def' => 0, 'ghi' => 0 } }; my $VAR2 = { 'Dav' => { 'jkl' => 12, 'mno' => 34, 'pqr' => 45 }, 'Adam' => { 'jkl' => 7, 'mno' => 0, 'pqr' => 7 } };
Expected output:
my $VAR3 = { 'Tim' => { 'abc' => 7, 'def' => 7, 'ghi' => 0 }, 'Adam' => { 'abc' => 0, 'def' => 0, 'ghi' => 0, 'jkl' => 7, 'mno' => 0, 'pqr' => 7 }, 'keas' => { 'abc' => 0, 'def' => 0, 'ghi' => 0 }, 'Dav' => { 'jkl' => 12, 'mno' => 34, 'pqr' => 45 } };
Monks, please explain me how to achieve this. Thanks in advanced
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to combine two different hashes into single hash.
by LanX (Saint) on Dec 28, 2019 at 23:17 UTC | |
by Sami_R (Sexton) on Dec 29, 2019 at 13:27 UTC | |
by LanX (Saint) on Dec 29, 2019 at 15:51 UTC | |
|
Re: How to combine two different hashes into single hash.
by tobyink (Canon) on Dec 28, 2019 at 23:17 UTC | |
by LanX (Saint) on Dec 28, 2019 at 23:38 UTC | |
by tobyink (Canon) on Dec 29, 2019 at 00:56 UTC | |
by Sami_R (Sexton) on Dec 29, 2019 at 14:26 UTC | |
|
Re: How to combine two different hashes into single hash.
by 1nickt (Canon) on Dec 29, 2019 at 00:19 UTC |