Melly has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monkeys,
I've got a big chunk of code for some data-transformation. Basically, it reads in some mapping information, some config options, and then processes a hefty data-file.
This data-file consists of n number of lines per subject, and the process handles each subject, reading, translating and outputting data, and then moves on to the next subject.
Now, all the subject-specific stuff uses local variables, and passes them to sub-routines in the approved fashion.
However, the mapping and config options are all stored in global vars.
How much of this is a no-no IYHO? (ONSHO?)
Tom Melly, pm (at) cursingmaggot (stop) co (stop) ukmap{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e**2 -$d**2+$b);$c=$d**2+$e**2>4?$d=8:_}1..50;print$c}0..59;print$/}0..20
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Global Vars
by roboticus (Chancellor) on Sep 04, 2009 at 13:36 UTC | |
by tbone1 (Monsignor) on Sep 04, 2009 at 13:57 UTC | |
by roboticus (Chancellor) on Sep 04, 2009 at 15:01 UTC | |
Re: Global Vars
by JavaFan (Canon) on Sep 04, 2009 at 14:52 UTC | |
by Melly (Chaplain) on Sep 04, 2009 at 16:13 UTC |