[sf-perl] Odd behavior for dot operator?

Andrew Sigmund ASIGMUND at altera.com
Thu Mar 17 23:19:01 PDT 2011


Yup, that was the problem.  I verified that the precedence of the dot operator is higher than that of the conditional operator.
So, by default, I was getting
$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.

Thanks Francisco.

Andy



-----Original Message-----
From: Francisco Obispo [mailto:fobispo at isc.org]
Sent: Thursday, March 17, 2011 23:03
To: Andrew Sigmund
Cc: SanFrancisco-pm at pm.org
Subject: Re: [sf-perl] Odd behavior for dot operator?

the problem is the precedence or the operators.

Try:

$x = 'a' . ( (defined $y) ? $y :'undef' ."\n");  # now I try to put something up front
print $x;




On Mar 17, 2011, at 10:55 PM, Andrew Sigmund wrote:

> $x = 'a' . (defined $y)? $y :'undef' ."\n";  # now I try to put something up front
> print $x;

Francisco Obispo
Hosted@ Programme Manager
email: fobispo at isc.org
Phone: +1 650 423 1374 || INOC-DBA *3557* NOC
Key fingerprint = 532F 84EB 06B4 3806 D5FA  09C6 463E 614E B38D B1BE






Confidentiality Notice.
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.



More information about the SanFrancisco-pm mailing list