I'm using a pretty complex hash table that needs to be in a central place, while a few scripts refer to it. Here is an example of the structure:

my %hashtable = ( STATION1 => { code => 'blue', parameters => ['a','b','c','d'], range => [4,7,6,9] }, STATION2 => { code => 'green', parameters => ['b','c','d','e'], range => [6,2,5,7] }, STATION3 => { code => 'red', parameters => ['a','c','d','e'], range => [8,2,1,5] }, );

"STATIONx" is determined by user input when executing the initial script. The scripts ratchet through each parameter and their parallel array values (value/param 0, 1, 2, etc.).

By using Exporter and placing the hash table in a module (method posted here http://stackoverflow.com/a/1551088), I was able to grab the "code" key, but could not figure out the syntax to grab param/range x. Can anyone lead me in the right direction?

Let me know if you need further info about the goals of this script (and please be easy; I'm learning).


In reply to Using Exporter with a complex hash by glemley8

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.