in reply to Design Question
Well you could create the array first as a global variable (to the package) then just manipulate it. Something like this:
my @array = (); sub processA { push(@array,$some_data); common_stuff(); # clear the array? } sub processB { for(1 .. 1000) { push(@array,$some_data); } common_stuff(); # clear the array? } sub common_stuff { foreach(@array) { #do stuff ... } }
With that you should always have just one array that gets no bigger than the largest amount of stuff you put in it. Of course it also depends on what you're doing with the data and weither or not you clear your array.
Lobster Aliens Are attacking the world!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Design Question
by David Caughell (Monk) on Aug 07, 2003 at 09:02 UTC |