Bryan R Harris wrote:
A question about the comma operator:
(John and Chas deserve a rest from my questions, if they want it =).
The binary comma operator in scalar context supposedly "evaluates its left
argument, throws that value away, then evaluates its right argument and
returns that value
On Thu, Aug 6, 2009 at 12:10, Bryan R Harris wrote:
>
>
> A question about the comma operator:
>
> (John and Chas deserve a rest from my questions, if they want it =).
>
> The binary comma operator in scalar context supposedly "evaluates its left
> argument, throws that value away, then evaluates
yes. using '&&', 'last' is always evaluated.
it is using 'and' that works, because it has lower precedence than comma.
so it parses as ($x eq 'a') and ( (print 'a'), last);
which is what i want. i didn't know there was difference between 'and' and
'&&'.
that is a bit of a gotcha for newbots.
On
On Thu, Mar 14, 2002 at 10:32:56AM -0800, 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 stat
ssage-
> 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
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