[Israel.pm] A bug in Perl ?

Levenglick Dov-RM07994 dovl at freescale.com
Thu Feb 8 06:58:47 PST 2007


Hi,
Actually in C && takes precedence over || as well.  


 
Best Regards,
Dov Levenglick
DSP SoC System and Applications Engineer,
Network and Computing Systems Group
Freescale Semiconductor Israel
Tel. +972-9-952-2804
The information contained in this email is classified as:
[ ] Freescale General Business Information
[ ] Freescale Internal Use Only
[ ] Freescale Confidential Proprietary
[x] Personal Memorandum

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf Of Yossi Itzkovich
Sent: Thursday, February 08, 2007 16:28
To: Perl in Israel
Subject: Re: [Israel.pm] A bug in Perl ?

 
Thanks Jason,

OK,  it is documented, but it still sounds weird, and differs from other
languages (at least C).

Yossi

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf Of Jason Elbaum
Sent: Thursday, February 08, 2007 2:09 PM
To: Perl in Israel
Subject: Re: [Israel.pm] A bug in Perl ?

No. && has higher precedence than ||, so this parses as (1 || (0 &&
0)), which is equivalent to (1 || 0).

See http://www.perl.com/doc/manual/html/pod/perlop.html

Regards,

Jason Elbaum


On 2/8/07, Yossi Itzkovich <Yossi.Itzkovich at ecitele.com> wrote:
> Hi,
>
> For this code:
> perl -we '$a=(1||0&&0); print  $a'
> I get "1",  although I should get "0"  .
>
> Isn't it a bug ?
>
> I am using perl v5.8.4
>
> Thanks
>
> Yossi
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
>
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl

_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl




More information about the Perl mailing list