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