For one, it's valid Perl syntax:
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
But it's probably not doing what you expect:
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
not has a much lower precedence than &&
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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|