in reply to passing hash ref to a function

my %ref_hash = %{$ref};

When you do that you are creating a copy. Don't do that if you want to modify the arguments.

sub test { my ($ref) = @_; $ref->{'new'} = 'new_v'; print join(",", keys (%$ref)),"\n"; }