glemley8 has asked for the wisdom of the Perl Monks concerning the following question:
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).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Using Exporter with a complex hash
by tobyink (Canon) on Oct 23, 2012 at 20:29 UTC | |
Re: Using Exporter with a complex hash
by NetWallah (Canon) on Oct 23, 2012 at 21:46 UTC | |
Re: Using Exporter with a complex hash
by Don Coyote (Hermit) on Oct 23, 2012 at 22:49 UTC |