to understand comma and lists better read
http://www.crusoe.net/~jeffp/articles/pm/2000-02.html

for your 'and' and '&&' difference one has precedence higher than the other.
see 
perldoc perlop
search for nonassoc for a list of the hierarchy.

> -----Original Message-----
> From: bob ackerman [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 14, 2002 1:37 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: comma operator
> 
> 
> now what? i tried 'and' instead '&&' and it worked - last 
> wasn't evaluated.
> that seems tricky to get right. i still don't understand why 
> 'last' isn't 
> always evaluated.
> 
> On Thursday, March 14, 2002, at 10:32  AM, bob ackerman wrote:
> 
> > confusion i have with comma operator.
> > docs seem to indicate it evaluates both sides, but i see 
> examples where 
> > it looks like if it evaluates to false on LHS it doesn't 
> evaluate RHS. i 
> > see this in examples of writing a case statement.
> > $x='b';
> > {
> > ($x eq 'a') && (print 'a'), last;
> > print 'x';
> > }
> > i see it work sortof sometimes - if $x isn't equal 'a', 
> 'last' isn't 
> > evaulated and it prints 'x'.
> > shouldn't it also evaluate 'last', whether the LHS of that 
> line is true 
> > or not?
> > in fact, i just tried it again and this time it didn't work - it 
> > evaluated 'last' and didn't print anything.
> >
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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

Reply via email to