Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: 'undef'ing a hash element

by arthas (Hermit)
on Aug 26, 2003 at 12:17 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://286669]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-25 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found