Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: eval order of args to a sub

by Tanktalus (Canon)
on May 30, 2007 at 18:55 UTC ( #618269=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      foo($i++); # ok
      foo(++$i); # ok
      foo($i,$i++); # not ok
      foo($i++,$i); # not ok
      foo($i++,++$i); # WTF?
    
  2. or download this
      my $flubber = do {
        my @args;
    ...
        push @args, ++$i;
        foo(@args)
      }; # well defined: $_[1] == $_[0]+2
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://618269]
help
Chatterbox?
NodeReaper takes a ball from the brass monkey

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2018-04-21 18:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?