my %hashA = ( orange=>'good', apple=>'bad' ); my %hashB = ( here=>'today', gone=>'tomorrow' ); myfunction(\%hashA,\%hashB); # send references to the hashes sub myfunction { my $hashrefA = shift; # (or $_[0]) my $hashrefB = shift; # (or $_[1]) my %hashA = %$hashrefA; # treat the refs as hashes and my %hashB = %$hashrefB; # copy the contents $hashA{extravalue} = "change seen in the subroutine only"; $hashrefA->{extravalue} = "change seen in the main program"; }