FAQ
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 .

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupbeginners @
categoriesperl
postedApr 29, '11 at 10:26a
activeApr 29, '11 at 11:31a
posts2
users2
websiteperl.org

2 users in discussion

Agnello George: 1 post Shlomi Fish: 1 post

People

Translate

site design / logo © 2021 Grokbase