use Data::Dumper; my $ref1 = { foo => 1, bar => 2 }; my $ref2 = { baz => 3, quux => 4 }; # Use a hash slice to override values from the first hash with the second hash @$ref1{ keys %$ref2 } = values %$ref2;