On Mon, Feb 8, 2010 at 9:00 PM, 7 wrote:
7> if (defined $var && ($var eq '' || $var eq '0')) {
7> #code
7> }
7> to handle cases where $var = undef. undef acts like it is a blank
7> string when used as a string.
blah..
unless( $var ) {
is all you need for that situation. you are already testing three of the
four allowed false values. and the numeric 0 would be covered under the
eq '0' test anyhow.
newbies should be taught perl's boolean false values early on.
Because unless and until statements are harder to maintain, NO ONE should
use them--least of all beginners.
On Mon, Feb 8, 2010 at 6:19 PM, Uri Guttman wrote:
"7" == 7 <7stud.7stud@gmail.com> writes:
"7" == 7 <7stud.7stud@gmail.com> writes:
7> #code
7> }
7> to handle cases where $var = undef. undef acts like it is a blank
7> string when used as a string.
blah..
unless( $var ) {
is all you need for that situation. you are already testing three of the
four allowed false values. and the numeric 0 would be covered under the
eq '0' test anyhow.
newbies should be taught perl's boolean false values early on.
Because unless and until statements are harder to maintain, NO ONE should
use them--least of all beginners.
Because unless and until statements are harder to *read and maintain*, NO
ONE should use them--least of all beginners.