Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: on the fly reference to subroutine output

by thirdm (Sexton)
on Mar 05, 2013 at 05:28 UTC ( #1021755=note: print w/ replies, xml ) Need Help??


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...

sub1 { ... return @a; } $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] be \@a 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.


Comment on Re^4: on the fly reference to subroutine output
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2015-07-07 08:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls