On Tue, Feb 25, 2003 at 12:21:49PM -0800, Jeff Westman wrote:

> Basic question on using '&&' vs 'and'.  I see that '&&' has higher precedence
> than 'and', but why does
> 
>   print 1 && 1 && 0;
>   print "\n";
>   print 1 and 1 and 0;
>   print "\n";
> 
> return 
>   0
>   1
> 
> I would have expected both statements to return 0.

s/return/print/g


Running your program through perl -MO=Deparse,-p gives:

print(0);
print("\n");
((print(1) and 1) and '???');
print("\n");

"and" has very low precedence.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to