Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: eval order of args to a sub

by TGI (Parson)
on May 31, 2007 at 00:29 UTC ( [id://618364]=note: print w/replies, xml ) Need Help??


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

Absolutely, the post-*crement operators MUST create an anonymous value, so they do.

I wonder though, what the "expected" or "natural" behavior of the other constructs I posted should be.

Construct Behavior Expected $i += 2 \$i ??? $i++ Anon. Anon. $i + 1 Anon. Anon. $i++ Anon. Anon. ++$i \$i Anon. $i=2 \$i ???

From reading the other posts here, I feel comfortable saying that people expect ++$i to pass an anonymous value. I'm not 100% sure what I'd expect the assignment operators (=, *=, etc) to pass. Since most langauges pass by value, I guess I'd expect the assignment operators to pass anonymous values equal to the value assigned to $i. For example for foo($i=2) my faulty intuition is that foo() would get an anonymous 2 in $_[0].


TGI says moo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (None)
    As of 2024-04-25 00:45 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found