in reply to Merging references

Hi,

I use simple hash merge concept here. i think this code will help you

use Data::Dumper; my $sub1 = { 'a' => {'apple' => 1 ,'ape' => 2}, 'b' => {'ball' => 1, 'bell' => 2} }; my $sub2 = { 'd' => {'dog' => 1}, 'c' => {'cat' => 1, 'clear'=> 2} }; my %hash = (%$sub1 ,%$sub2); print "\n". Dumper( \%hash);

thanks

ASHOK

Replies are listed 'Best First'.
Re^2: Merging references
by chromatic (Archbishop) on Dec 29, 2006 at 00:56 UTC

    Unfortunately, that overwrites second-level hashes. Hash::Merge is a better solution.