If I am just missing an FAQ, please forgive me, but I didn't see this in either the Q&A or via Supersearch.
I have many many subs in my program, many called sequentially, or from within other subs. Some of these down-the-line subs require inputs from the output of a sub 5 or 6 places back up the line. i.e.
What I've been doing so far has been passing the variable through each and every intervening sub. I had originally made them global rather than scoped to each individual sub, but many people were suggesting that was a big drain on memory, esp since some of these are huge arrays, etc.sub First { # do something.... return $info_required_not_until_sub_seven; } sub Seventh { my $input_from_first = shift; my $input_from_fourth = shift; my $input_from_sixth = shift; #etc... }
My question is, is there a way to hold on to a locally scoped variable, to pass it on later, or even something along the lines of :
?from sub FIRST get $input_required_not_until_seventh
Thanks,
Matt
In reply to Getting variables from mulitple subs at once? by mdunnbass
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |