Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^5: More efficient dereferencing of a subroutine return

by AnomalousMonk (Abbot)
on Feb 19, 2013 at 23:26 UTC ( #1019677=note: print w/ replies, xml ) Need Help??


in reply to Re^4: More efficient dereferencing of a subroutine return
in thread More efficient dereferencing of a subroutine return

This also works and is 'shorter', although I would not say more maintainable:

>perl -wMstrict -MData::Dump -le "sub fillArrays { my( $r1, $r2 ) = @_; @$r1 = qw(one two three); @$r2 = qw(four five six seven); } ;; fillArrays( \my (@arr1, @arr2) ); ;; dd \@arr1, \@arr2; " (["one", "two", "three"], ["four", "five", "six", "seven"])


Comment on Re^5: More efficient dereferencing of a subroutine return
Download Code
Re^6: More efficient dereferencing of a subroutine return
by gg48gg (Sexton) on Feb 20, 2013 at 19:49 UTC
    Thanks to all of you. I am going to stick to the "keep it simple, stupid" philosophy even though it is more lines and typing. I appreciate everyones' replies.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2015-07-03 15:43 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 (53 votes), past polls