Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: 'undef'ing a hash element

by arthas (Hermit)
on Aug 26, 2003 at 12:17 UTC ( #286669=note: print w/replies, xml ) Need Help??


in reply to 'undef'ing a hash element

Hi!

You should use:

delete $hash{$a}

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

Michele.

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://286669]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2019-05-19 22:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (122 votes). Check out past polls.

    Notices?