Importing 80+ hashed and 1 array into several perl scripts

Discussion in 'Perl' started by Matt Breedlove, Nov 24, 2003.

  1. 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
    Matt Breedlove, Nov 24, 2003
    #1
    1. Advertising

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

    <snip>
    > 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.
    Eduard W. Lohmann, Nov 24, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel
    Replies:
    1
    Views:
    1,048
    Kevin Collins
    Aug 14, 2003
  2. Glenn
    Replies:
    0
    Views:
    1,056
    Glenn
    Jun 28, 2007
  3. Replies:
    2
    Views:
    163
    Robert Klemme
    May 12, 2006
  4. Ian
    Replies:
    3
    Views:
    166
  5. dysgraphia

    Running several Perl scripts

    dysgraphia, Mar 17, 2007, in forum: Perl Misc
    Replies:
    2
    Views:
    114
    dysgraphia
    Mar 17, 2007
Loading...

Share This Page