sub test { my $hash1 = shift; my %hash2 = %{shift}; $hash1->{three} = 3; $hash2{three} = 3; } my %a = (one => 1, two => 2); my %b = (one => 1, two => 2); &test(\%a, \%b); print join(", ", keys %a), "\n"; print join(", ", keys %b), "\n"; # three, two, one # two, one