<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:'times new roman', 'new york', times, serif;font-size:12pt"><div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">A handy module for this sort of thing is B::Deparse.</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><br></font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">From the docs:</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">With -p, it uses parentheses (almost) whenever they would be legal. </font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">This can be useful if you are used to LISP, or if you want to see how perl parses your input.</font></div><div><font class="Apple-style-span" face="'times new roman',
 'new york', times, serif"><br></font></div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div></div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><div>[dwright~(8)]$ perl -w -MO=Deparse,-p</div><div>$x = 'a' . (defined $y)? $y :'undef' ."\n";</div><div>print $x;</div><div>^D</div><div>BEGIN { $^W = 1; }</div><div>($x = (('a' . defined($y)) ? $y : "undef\n"));</div><div>print($x);</div><div>- syntax OK</div></div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; color: black; "><br><div style="font-family:arial, helvetica, sans-serif;font-size:10pt"><font size="2"
 face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Andrew Sigmund <ASIGMUND@altera.com><br><b><span style="font-weight: bold;">To:</span></b> Francisco Obispo <fobispo@isc.org><br><b><span style="font-weight: bold;">Cc:</span></b> "SanFrancisco-pm@pm.org" <SanFrancisco-pm@pm.org><br><b><span style="font-weight: bold;">Sent:</span></b> Thu, March 17, 2011 11:19:01 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [sf-perl] Odd behavior for dot operator?<br></font><br>
Yup, that was the problem.  I verified that the precedence of the dot operator is higher than that of the conditional operator.<br>So, by default, I was getting<br>$x = ( 'a' . (defined $y) )? $y ....  which is always true, so perl was trying to actually use the undefined $y, and thus gave me the warning.<br><br>Thanks Francisco.<br><br>Andy<br><br><br><br>-----Original Message-----<br>From: Francisco Obispo [mailto:<a ymailto="mailto:fobispo@isc.org" href="mailto:fobispo@isc.org">fobispo@isc.org</a>]<br>Sent: Thursday, March 17, 2011 23:03<br>To: Andrew Sigmund<br>Cc: <a ymailto="mailto:SanFrancisco-pm@pm.org" href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br>Subject: Re: [sf-perl] Odd behavior for dot operator?<br><br>the problem is the precedence or the operators.<br><br>Try:<br><br>$x = 'a' . ( (defined $y) ? $y :'undef' ."\n");  # now I try to put something up front<br>print $x;<br><br><br><br><br>On Mar 17, 2011, at
 10:55 PM, Andrew Sigmund wrote:<br><br>> $x = 'a' . (defined $y)? $y :'undef' ."\n";  # now I try to put something up front<br>> print $x;<br><br>Francisco Obispo<br>Hosted@ Programme Manager<br>email: <a ymailto="mailto:fobispo@isc.org" href="mailto:fobispo@isc.org">fobispo@isc.org</a><br>Phone: +1 650 423 1374 || INOC-DBA *3557* NOC<br>Key fingerprint = 532F 84EB 06B4 3806 D5FA  09C6 463E 614E B38D B1BE<br><br><br><br><br><br><br>Confidentiality Notice.<br>This message may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution,  or copying  of this message, or any attachments, is strictly prohibited.  If you have received this message in error, please advise the sender by reply e-mail, and delete the message and any attachments.  Thank
 you.<br><br>_______________________________________________<br>SanFrancisco-pm mailing list<br><a ymailto="mailto:SanFrancisco-pm@pm.org" href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br><span><a target="_blank" href="http://mail.pm.org/mailman/listinfo/sanfrancisco-pm">http://mail.pm.org/mailman/listinfo/sanfrancisco-pm</a></span><br></div></div><div style="position: fixed; color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "></div>


</div></body></html>