Hi Agnello,

On Friday 29 Apr 2011 13:26:29 Agnello George wrote:
> HI
> 
> I have as hash within my script.pl file which look like this
> 
> ### code follows
> 
> 
> 
> 
> 
> But it obviously looks too messy to add it all in one script.pl  , as
> i am going to add new keys and values to the hash , and as i am going
> to keep adding  to the hash later on  i would  need to automatically
> generate my hash from a database, what is the best way to maintain the
> config file which will contain the hash , and how do i use it within
> multiple scripts .

You should create a module for that: define a global variable and put a 
subroutine that returns a reference to it. Note that you should probably use 
YAML or JSON or perhaps JSYNC, for this configuration file if you are going to 
use a module, because outputting Perl code from a larger program is error 
prone, and people may be tempted to edit this code by hand.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Why I Love Perl - http://shlom.in/joy-of-perl

I hope that you agree with me that 99.9218485921% of the users wouldn't bother
themselves with recompilation (or any other manual step for that matter) to
make their games run 1.27127529900685765% faster ;-) -- Nadav Har'El

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to