http://qs1969.pair.com?node_id=296526


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.