in reply to
Re^3: on the fly reference to subroutine output
in thread on the fly reference to subroutine output
Ah, I'm always forgetting this.
But underneath, is there a chance at some kind of return value optimization? Say if you have...
$r = [sub1];
Even if it's officially turning the values of @a into a list en route to copying them into the array that the brackets create a reference to, could perl not notice @a is no longer needed otherwise and instead simply make [sub1]
behind the scenes? It would be neat if you could write sub1 that way instead of making it return \@a even if you anticipated the copy to be expensive.