http://qs321.pair.com?node_id=196629

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:
%hash1 = ( red => 1, brown => ( green => 1, blue => ( yellow => 1, ), black => 1, ), gray => 1, ); %hash2 = ( white => 1, brown => ( purple => 1, ), );
I want to get in the end the following hash:
%mergedHash = ( red => 1, gray => 1, white => 1, brown => ( green => 1, purple => 1, black => 1, blue => ( yellow => 1, ), ), );
another thing, how can I do this if I have references of hashes (replace the brackets with curly ones in the example above)?

Thanks

Hotshot