use strict; use Data::Dumper; my %hash = qw/ A 1 B 2 /; print 'Before sub:'.Dumper(\%hash); modify_hash(\%hash); print 'After sub:'.Dumper(\%hash); sub modify_hash{ my $h_ref = shift; $h_ref->{C} = '3'; $h_ref->{D} = '4'; %{$h_ref}->{E} = '5'; # this is what it's doing $$h_ref{F} = '6'; # you could do this too }