in reply to Re^2: Optimising concat (was Order of evaluation/interpolation of references)
in thread Order of evaluation/interpolation of references

It just occurred to me that using a list concat would cause the OP's

print "${X()} ${X()}\n";

to behave the same as his

print "${X()}${X()}\n";

Faster AND fewer surprises :) (Or is it su-prises?)

Of course, the OP will still be surprised by the difference in

$ perl -E'my $x=5; sub X { \(++$x) } say ${ X() } + ${ X() };' 14 $ perl -E'my $x=5; sub X { \(++$x) } say ${ X() } + 0 + ${ X() };' 13