"be consistent" | |
PerlMonks |
Re: testing a non-existant hash entry...how to handleby ton (Friar) |
on Mar 01, 2002 at 19:40 UTC ( [id://148660]=note: print w/replies, xml ) | Need Help?? |
The best way to check for the existance of a key in a hash is to use the exists function. Checking against the hash value doesn't always work, because you could have that value be 0. In fact, you could have that value be undef, so defined does not always give the right behavior either. Example:
-Ton ----- Be bloody, bold, and resolute; laugh to scorn The power of man...
In Section
Seekers of Perl Wisdom
|
|