in reply to delete hash key/value in subroutine
my %hash = ('key1' => 'v1', 'key2' => 'v2'); del_hash_key(\%hash); sub del_hash_key { my $hash = shift; local $hash->{'key1'} = undef; # Until end of scope. print %$hash; # Prints the latter key/value pair print "\n"; } print %hash; # Prints both key/value pairs
|
|---|