in reply to scoping large arrays - newbie Q
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: scoping large arrays - newbie Q
by moof1138 (Curate) on Jun 18, 2002 at 04:40 UTC | |
by jeffa (Bishop) on Jun 18, 2002 at 05:39 UTC | |
by samtregar (Abbot) on Jun 18, 2002 at 07:06 UTC | |
by shotgunefx (Parson) on Jun 18, 2002 at 09:01 UTC |