hotshot has asked for the wisdom of the Perl Monks concerning the following question:
hi fellers !
how can I merge several hashes to one. suppose I have the following hashes:
Thanks
Hotshot
how can I merge several hashes to one. suppose I have the following hashes:
I want to get in the end the following hash:%hash1 = ( red => 1, brown => ( green => 1, blue => ( yellow => 1, ), black => 1, ), gray => 1, ); %hash2 = ( white => 1, brown => ( purple => 1, ), );
another thing, how can I do this if I have references of hashes (replace the brackets with curly ones in the example above)?%mergedHash = ( red => 1, gray => 1, white => 1, brown => ( green => 1, purple => 1, black => 1, blue => ( yellow => 1, ), ), );
Thanks
Hotshot
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Merging hashes
by valdez (Monsignor) on Sep 10, 2002 at 12:50 UTC | |
Re: Merging hashes
by kabel (Chaplain) on Sep 10, 2002 at 12:07 UTC | |
by hotshot (Prior) on Sep 10, 2002 at 12:19 UTC | |
by shotgunefx (Parson) on Sep 10, 2002 at 12:31 UTC | |
by hotshot (Prior) on Sep 10, 2002 at 12:35 UTC | |
by shotgunefx (Parson) on Sep 10, 2002 at 12:49 UTC | |
Re: Merging hashes
by abell (Chaplain) on Sep 10, 2002 at 13:02 UTC |
Back to
Seekers of Perl Wisdom