Thank you all for your replies. Before sending the question to the list I asked 3 experienced C/C++ persons, and we all thought it is differently in C.
Thanks again. Yossi -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nasriachi, Micha Sent: Thursday, February 08, 2007 5:01 PM To: Perl in Israel Subject: Re: [Israel.pm] A bug in Perl ? Check http://en.wikipedia.org/wiki/Operators_in_C_and_C++ Precedence order for these operators in Perl is the same as in C and C++. ;-) Micha -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason Elbaum Sent: Thursday, February 08, 2007 4:55 PM To: Perl in Israel Subject: Re: [Israel.pm] A bug in Perl ? I get the same results from C. Jason On 2/8/07, Yossi Itzkovich <[EMAIL PROTECTED]> wrote: > > Thanks Jason, > > OK, it is documented, but it still sounds weird, and differs from other > languages (at least C). > > Yossi > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 <[EMAIL PROTECTED]> 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 > > [email protected] > > http://perl.org.il/mailman/listinfo/perl > > > _______________________________________________ > Perl mailing list > [email protected] > http://perl.org.il/mailman/listinfo/perl > > _______________________________________________ > Perl mailing list > [email protected] > http://perl.org.il/mailman/listinfo/perl > _______________________________________________ Perl mailing list [email protected] http://perl.org.il/mailman/listinfo/perl _______________________________________________ Perl mailing list [email protected] http://perl.org.il/mailman/listinfo/perl _______________________________________________ Perl mailing list [email protected] http://perl.org.il/mailman/listinfo/perl
