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!In reply to Re: Design Question
by cfreak
in thread Design Question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |