use Data::Dumper; my $VAR1 = { "baz" => [1,2,3,4] }; my $VAR2 = $VAR1; print "BEFORE\n", Dumper($VAR1, $VAR2); # Note $VAR1 is changed, but $VAR2 is still the hashref. replace_ref($VAR1); print "AFTER\n", Dumper($VAR1, $VAR2); sub replace_ref { $_[0] = $_[0]{baz}; }