Joel wrote:
Thank you Rob.

I am aware of that actually. To state my confusion, I wil get a better
example:

For the following code,

   sub fun {
     print "fun(@_) ";
   }

   fun 1, fun ''b" | "c", 1;

The output looks like:
fun(c,1) fun(1,1)

*but*  the precedence of the operators used is as:  comma operator,
list operator, bitwise string operator.
>
*so* the commas and list operators should be evaluated before the pipe
gets a chance.
>
so the right hand side of the pipe is discarded, passing only "b" to
the funciton because the list operator is evaluated before the pipe.
But this doesn't seem to be happening!

like how in code: $a = 1, 2;
2 is discarded because  comma has lower precedence than the assignment
operator.

(Please bottom-post your replies on this list so that extended threads
remain comprehensible. Thank you.)

No. Highest priority is the bitwise-or, then the commas after a list
operator, then the list operator, then the commas before it. So

  fun(1, fun(('b' | 'c'), 1));

perldoc perlop has a list of operator priorities.

Rob


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to