in reply to Re: Re: scoping large arrays - newbie Q
in thread scoping large arrays - newbie Q
If the array in question is only pertinent to the subroutine, and either that sub will only be called once or the array will change with each sub call, then declare the array inside the subroutine.use strict; sub mySub { my $ref = shift; for (@$ref) { #do stuff with array } } my @bigarray = ("insert", "a very", "long list here"); my $thing1 = mySub(\@bigarray); my $thing2 = mySub(\@bigarray);
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|