in reply to Re^2: eval order of args to a sub
in thread eval order of args to a sub
I think the moral of the story is "understand what you are passing to your functions".
It appears that most ways that one might modify a variable in a function call will result in an alias to the variable being passed. Post-increment seems to be unique in that it creates an anonymous value.
C:\>perl -e "sub foo{ print join qq/\n/, map { \$_ .' - ' . $_ } @_ } +foo($i=1,++$i,$i++,$i+1,$i+=1,$i); SCALAR(0x183059c) - 4 SCALAR(0x183059c) - 4 SCALAR(0x225f7c) - 2 SCALAR(0x18305fc) - 4 SCALAR(0x183059c) - 4 SCALAR(0x183059c) - 4
TGI says moo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: eval order of args to a sub
by Joost (Canon) on May 30, 2007 at 21:15 UTC | |
by TGI (Parson) on May 31, 2007 at 00:29 UTC |