Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Deleting hash entry

by talexb (Canon)
on Dec 16, 2003 at 15:05 UTC ( #315065=note: print w/replies, xml ) Need Help??


in reply to Deleting hash entry

    What happen if I do: delete($hash{abc}{def});

I would hazard a guess that the hash key value pair you have specified would be deleted. What happens when you try it? (I did not.)

    .. is there a short way to delete also the first level key ('abc' in the example) when deleted all second level keys under it.

Sure, I would use delete($hash{abc})
This would delete the top level and everything underneath it.

And now, an editorial comment ..

Please, I would strongly urge you (and anyone else) to go into the Perl debugger and try these things out rather than posting here. Wait until you've tried a bunch of things and are well and truly stumped. We love interesting, challenging questions. Questions that show no effort leave us uninspired.

--t. alex
Life is short: get busy!

Replies are listed 'Best First'.
Re^2: Deleting hash entry
by Anonymous Monk on Oct 19, 2012 at 12:57 UTC
    Alex, your forgetting the usefulness of this forum as a reference.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://315065]
help
Chatterbox?
[Lady_Aleena]: Now I will see if my perl-fu is as bad as I think it is.
[shmem]: ah, geany uses its own idea of tags. Ah well...
[Lady_Aleena]: My perl-fu is bad.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2017-04-27 12:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (506 votes). Check out past polls.