in reply to Pass by reference question...

Because you are making a copy of the reference, and then you modify the copy. Either change the alias, or modify what the reference is pointing to:
sub assign_new_ref { $_[0] = {new_key => 4}; # Change alias } sub assign_new_ref { my $href = shift; %$href = (new_key => 4); # Change what the reference is pointing t +o }
Code is untested.