Just another Perl shrine | |
PerlMonks |
Re^2: Replacing If Elsif Else with Hashby sundialsvc4 (Abbot) |
on Nov 25, 2012 at 03:35 UTC ( [id://1005459]=note: print w/replies, xml ) | Need Help?? |
I strongly agree with this ... no matter how exactly you choose to write the routine or to initialize the hash. When writing this sort of logic, be extremely careful to test for the existence, or the absence, of the hash key ... not for “falsehood.” Someday you will have a hash-entry whose legitimate value translates to false. Or even maybe to undef. It’s just a hungry sort of “gotcha” that’s just waiting for your glutes.
In Section
Seekers of Perl Wisdom
|
|