Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^10: eval order of args to a sub

by shmem (Chancellor)
on Jun 05, 2007 at 09:49 UTC ( [id://619330]=note: print w/replies, xml ) Need Help??


in reply to Re^9: eval order of args to a sub
in thread eval order of args to a sub

You are both right, mrpeabody and ikegami - it's not in the specs; but my take on this is that in the expression
$result = 8 - 4 - 2;

the term 8 - 4 is a subexpression and the operand for the rightmost substraction operation; from that I deduce that associativity therefore defines the operand and subexpression evaluation order.

That might be a logical fallacy; which one, I wonder?

Anyways, that's how perl does it, although it is not defined in Perl. Of course the implementation could change, and perl could do a breadth-first evaluation of its execution tree and roll a dice for ad-hoc definition of evaluation order. But the optimizer would set things straight again, I guess :-)

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://619330]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-28 13:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found