Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Order of execution of functions in list

by ikegami (Pope)
on Sep 13, 2013 at 13:23 UTC ( #1053930=note: print w/ replies, xml ) Need Help??


in reply to Order of execution of functions in list

Operand evaluation order isn't defined for all operators[1], but it is for this one.

Quote perlop,

In list context, [,] is just the list argument separator, and inserts both its arguments into the list. These arguments are also evaluated from left to right.

That's perfectly fine.


  1. For example, Perl doesn't define the order in which f, g and h will be called by f() + g() + h().


Comment on Re: Order of execution of functions in list
Select or Download Code
Re^2: Order of execution of functions in list
by vsespb (Hermit) on Sep 13, 2013 at 13:26 UTC
    Ok, thanks! That was exactly what I looked for!
Re^2: Order of execution of functions in list
by LanX (Canon) on Sep 13, 2013 at 14:17 UTC
    So in function calls it's not a list argument separator ?

    function($i++,++$i) ???

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      So in function calls it's not a list argument separator ?

      Sure it is.

      function($i++,++$i) ???

      $i++ is going to be evaluated before ++$i.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-12-26 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (169 votes), past polls