Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^3: conditional print. Is correct to use it?by kcott (Archbishop) |
on Oct 29, 2020 at 03:50 UTC ( [id://11123288]=note: print w/replies, xml ) | Need Help?? |
Pretty much what ++hippo said. :-) length will return FALSE for both '' and undef, and TRUE for both 0 and '0'. It's first documented as doing that in 5.12.0; however, there was a bug that was fixed in 5.14.0 (perl5140delta: Syntax/Parsing Bugs) so I'd be more comfortable with both defined and length if using anything earlier than 5.14.0.
— Ken
In Section
Seekers of Perl Wisdom
|
|