sub foo { my @array = ( 0 .. 100 ); # create a new array bar(\@array); # pass it to bar() by reference } sub bar { my $array_ref = shift; # get reference to foo()'s array foreach (@$array_ref) { # print out each value print; } }
If this is your first encounter with references then you've got some learning to do. I suggest you pick up a copy of Learning Perl or Programming Perl and dig in!
-sam
In reply to Re: scoping large arrays - newbie Q
by samtregar
in thread scoping large arrays - newbie Q
by moof1138
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |