|Perl Monk, Perl Meditation|
Re: Clear / Initialize multiple hashesby BrowserUk (Pope)
|on Sep 19, 2013 at 18:05 UTC||Need Help??|
I just want to check if this is a viable way to clear or initialize a set of hashes:
No. Your code does nothing.
This bit: %_ = () would assign nothing to the hash %_; which is probably empty anyway.
But that code is never invoked because this bit: for my(%hash1,%hash2,%hash3); doesn't result in anything, so the for never iterates.
The overall effect of you code is exactly the same as just: my(%hash1,%hash2,%hash3);
And the only reason "it seems to work fine"; is because it is not necessary to clear or initialise variables when you declare them.
Any variable declared with my, is a new clean, empty variable. You don't need to do anything to it to make it so.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.