But it's probably not doing what you expect:D:\Temp>perl -c -e "if (not defined($pname) && $pname ne '' && defined +($policy_ur) && $policy_ur ne '' && not defined($odate) && $odate ne +''){}" -e syntax OK
not has a much lower precedence than &&D:\Temp>perl -MO=Deparse,p -e "if (not defined($pname) && pname ne '' +&& defined($policy_ur) && $policy_ur ne '' && not defined($odate) && +$odate ne ''){}" if (not defined $pname && $pname ne '' && defined $policy_ur && $polic +y_ur ne '' && !(defined $odate && $odate ne '')) { (); } -e syntax OK
use either not and and or ! and && in conjunction to get the intended effect.
Update: Seems like newly accuired syntax highlighting was distracting me ;-). Though a little bit complicated the assembly of the leading not (inverting the result of the whole test) with the && (chaining all the inner sub-tests together) makes sense.
In reply to Re: if not defined
by pKai
in thread if not defined
by Trihedralguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |