sub foo { my $hashref = shift; delete $hashref->{a}; print keys %$hashref; } %x = (a => 1, b => 2); foo(\%x); print $x{a};