Importing 80+ hashed and 1 array into several perl scripts

M

Matt Breedlove

Ok, I dont see why this is so difficult, but it seems like all the
solutions
I have researched require me to identify each incoming variable which
is very
undesirable as there are 80+ hashes and 1 array.

Basically i have 5 script files that utilise the same 80+ hashes and
as it stands now I have the info duplicated in each script file, but
as this data will need to be modified from time to time, I would like
to have all the variables in a single config type file.

Here is a sample of the the config type file which just has alot of
hashes
%JUNIORS_SLEEPWEAR = (
"061" => "041",
"153" => "041",
"315" => "041",
"863" => "041",
"904" => "041",
"982" => "041",
"9041"=> "041"
);

%JUNIORS_SNOW_FLEECE = (
"315" => "043",
"904" => "043",
"982" => "043",
"9043" => "043"
);
%JUNIORS_SNOW_PANTS = (
"039" => "044",
"153" => "044",
"315" => "044",
"982" => "044",
"9044" => "044"
);

%JUNIORS_SNOW_JACKETS = (
"039" => "045",
"153" => "045",
"315" => "045",
"982" => "045",
"9045" => "045"
);
%JUNIOR_HOOD_CREW_SWEATSHIRTS = (
"144" => "046",
"153" => "046",
"315" => "046",
"863" => "046",
"865" => "046",
"904" => "046",
"941"=> "046",
"982" => "046",
"9046" => "046"
);

All I want are all 80+ hashes to be available in each script memory
space
I dont understand why there isnt a module where I can "use" and just
pass it an
absolute path of the script that contains all the hashes and in one
wonderful line have all the hashes loaded into that script and
available for interation?
Perhaps I'm just missing something reall basic...I'm not a newbie to
perl by any means, but have never had to do this sort of thing before
Thanks in advance
 
E

Eduard W. Lohmann

On Mon, 24 Nov 2003 10:50:50 -0800, Matt Breedlove wrote:

Basically i have 5 script files that utilise the same 80+ hashes and
as it stands now I have the info duplicated in each script file, but
as this data will need to be modified from time to time, I would like
to have all the variables in a single config type file.
<snip>

You mean like:

do 'filename.pl';

Just create all the hashes in a separate file, and 'do' it in each script.

Good luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top