my %hash = ( 'animal' => 'bear', 'plant' => 'oak', 'fungus' => 'truffle', ); test(\%hash); print join(",", keys (%hash)),"\n"; sub test { my ($ref) = @_; my %ref_hash = %{$ref}; $ref_hash{'new'} = 'new_v'; print join(",", keys (%ref_hash)),"\n"; } #### plant,new,fungus,animal plant,animal,fungus #### plant,new,fungus,animal plant,new,fungus,animal