%a = qw(cat dog); print $a{cat}; foo(%a); print $a{cat}; sub foo { $_[1] = "elephant" } #### %a = qw(cat dog); print $a{cat}; %a = foo(%a); # <-- note assignment print $a{cat}; sub foo { my %temphash = @_; $temphash{cat} = "elephant"; %temphash; }