as you are testing not only that the value is defined, but that the value is also not zero or an empty string. As a general practice, you should be writing:if ($variable and $variable eq 'value') { # do something # ... }
if ((defined $variable) && ($variable eq 'value')) { # do something # ... }
In reply to Re^4: Use of uninitialized value??
by Anonymous Monk
in thread Use of uninitialized value??
by powerhouse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |