"be consistent" | |
PerlMonks |
Re: Undefined vs empty stringby Athanasius (Archbishop) |
on Jun 05, 2013 at 02:29 UTC ( [id://1037090]=note: print w/replies, xml ) | Need Help?? |
undef and "" are indeed different in Perl, but both are boolean false, so the test can be simplified to:
See perlsyn#Truth-and-Falsehood. Update: Except that "0" is also false, so if that’s a possibility, prefer BrowserUk’s solution, below. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|