$x = { foo => "abc", from => 'x' }; $y = { bar => "def", baz => "ghi", from => 'y' }; my $merged_x = { %$y, %$x }; my $merged_y = { %$x, %$y };