sub function { my $hashref = shift; $hashref->{three} = 3; } my %hash = ( one => 1, two => 2 ); &function(\%hash); print join(", ", keys %hash); # one, two, three