Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Answer: How do I empty out a hash?

by Aristotle (Chancellor)
on Oct 04, 2003 at 16:10 UTC ( [id://296526]=note: print w/replies, xml ) Need Help??


in reply to Re: How do I empty out a hash?
in thread How do I empty out a hash?

Easier yet.
delete @hash{(keys %hash)};
Update: this is, of course, only useful when you want to use delete the keys from one hash in another one, as in
delete @foo{(keys %bar)};
Otherwise, only the below solution makes any sense.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: Answer: How do I empty out a hash?
by Anonymous Monk on Oct 04, 2003 at 16:23 UTC

    Even more easier!

    %hash = ();

    And twice more quicker also.

Log In?
Username:
Password:

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

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

    No recent polls found