in reply to 'undef'ing a hash element


You should use:

delete $hash{$a}

This removes the key/value pair. undef only sets the key's value to the undefined value.


Replies are listed 'Best First'.
Re: Re: 'undef'ing a hash element
by welchavw (Pilgrim) on Aug 26, 2003 at 13:49 UTC
    This is a little off-topic, but you may find the info useful in the long run. For fun, check out Hash::NoVivify to learn about a related subtlety of hash key management and a module for dealing with it.