Topic awaiting preservation: Defining Global Arrays (Page 1 of 1) |
|
---|---|
Maniac (V) Mad Scientist From: 127 Halcyon Road, Marenia, Atlantis |
posted 09-22-2002 05:23
I want to define a series of arrays and I need them to be globaly set, but I can only determine if they are necessary from deep inside of a function... |
Paranoid (IV) Inmate From: California |
posted 09-22-2002 05:41
Hi Petskull, code: my @ARRAY = [];
code: use vars qw/$IN $DB $CFG @ARRAY/;
|
Maniac (V) Mad Scientist From: 127 Halcyon Road, Marenia, Atlantis |
posted 09-22-2002 06:37
see, the thing is that I will end up defining a LOT of arrays that I don't need... I think that by defining only the arrays I'm going to use- which may be only a small fraction of the total arrays I would set up otherwise- I would save on cpu and mem usage, leaving me with faster and smoother code that's one step closer to optimization.. |
Paranoid (IV) Inmate From: California |
posted 09-24-2002 06:09
How about using a single hasref of arrays? You would just add your arrays to the hasref as needed. Take a look at this: code: #!/usr/bin/perl -w
|