Merging two hash references in Perl
Merging or combining two or more hash references in perl is a trivial task:my $x = {a => 1, b => 2};
my $y = {c => 3, d => 4};
my $z = {%$x, %$y};
The resulting hash reference will have keys from both the $x and $y references, with precedence given to the hash reference on the left ($x in this case).
Last updated: 23/11/2013