The problem is actually that || is quite strong (sorry, can't find a better translation from italian), and perl is actually seeing not defined ($username || $username eq ""). To make it work you could just change || with a lower-precedence or. This snippet of code:
$username = undef ; if (not defined $username || $username eq "") { print "Yep!\n" } if (not defined $username or $username eq "") { print "Yup!\n" }
prints Yup!.
Ciao!
--bronto
In reply to Re: When art thy variables defined?
by bronto
in thread When art thy variables defined?
by caedes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |