Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: defining variables using my - subroutines

by NetWallah (Abbot)
on Sep 05, 2012 at 15:52 UTC ( #991882=note: print w/ replies, xml ) Need Help??


in reply to defining variables using my - subroutines

my ($generated_array_ref, $generated_var) = Generator(); Second_sub_receives_array_ref( $generated_array_ref, $generated_var); sub Generator{ my $localvar=33; return ([0..50], # Generated array ref $localvar); } sub Second_sub_receives_array_ref{ my ($rcvd_arrayref, $rcvd_var) = @_; for (@$rcvd_arrayref){ # array element is available as $_ } }
UNTESTED.

             I hope life isn't a big joke, because I don't get it.
                   -SNL


Comment on Re: defining variables using my - subroutines
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2015-07-28 06:11 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 (252 votes), past polls