in reply to Re^2: Evaluation Order again.
in thread Evaluation Order again.
Your incorrect expectation has nothing to do with operand evaluation order; it's that you didn't take into account that Perl always passes by reference.
The following demonstrates that the operand evaluation order used is the one that was documented.
use Data::Alias qw( alias ); sub func { print $_, ' ' for @_; print "\n"; $_[2]; } { my $i = 3; func( $i, ++$i, $i+2 ); } { my $i = 3; local @_; alias push @_, $i; alias push @_, ++$i; alias push @_, $i+2; &func; }
4 4 6 4 4 6
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Evaluation Order again.
by Tanktalus (Canon) on May 30, 2016 at 19:35 UTC |