Merge two hash variable : Hash Assignment « Hash « Perl






Merge two hash variable

    

$h1{fruit} = apple;
$h1{sandwich} = hamburger;
$h1{drink} = bubbly;

$h2{cake} = chocolate;
$h2{pie} = blueberry;
$h2{'ice cream'} = pecan;

%h3 = (%h1, %h2);
print $h3{'ice cream'}; 

   
    
    
    
  








Related examples in the same category

1.Hash hash overwrites
2.Hashes Assignment in action
3.Hash List Assignment