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
In reply to Re: delete hash key/value in subroutine
by ikegami
in thread delete hash key/value in subroutine
by coldy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |