crusty_collins has asked for the wisdom of the Perl Monks concerning the following question:
I need to determine the value of daemonPort and all other variables. If I am running on chilsd03 the value would be 9000 but anywhere else it would be 7500. I refer to this as the scope of the variable being either global or local. I need to scope this further to instance where there can be lines like.*rvd*startScript : /binlib/mdi/rv/etc/start_rvd *rvd*daemonPort : 7500 *rvd*rrcp*sendRate*bufferSize : 1000 chilsd03*rvd*daemonPort : 9000
So, the problem I am facing is that I need to figure out a good way to "walk" the hash and load up global and local values but keeping the integrity of the instances. Ideally I need to end up with a hash ofchilsd03*rvd*OUT*daemonPort : 9000
0 'rvd' 1 HASH(0x83d6a40) 'daemonPort' => 7500 'daemonProtocol' => 'tcp' 'httpPort' => 7580 'reliability' => 60 'startScript' => '/binlib/mdi/rv/etc/start_rvd' 'version' => 6.9 4 'IN' 5 HASH(0x83d6b0c) 'daemonPort' => 7500 'daemonProtocol' => 'tcp' 'httpPort' => 8590 'instanceName' => 'IN' 'reliability' => 60 'startScript' => '/binlib/mdi/rv/etc/start_rvd' 'version' => 6.9 6 'instances' 7 ARRAY(0x83d68f0) 0 'rvd' 1 'IN' What I get instead 0 'rvd' 1 HASH(0x83d6938) 'daemonPort' => 7500 'daemonProtocol' => 'tcp' 'httpPort' => 7580 'reliability' => 60 'startScript' => '/binlib/mdi/rv/etc/start_rvd' 'version' => 6.9 2 'rrcp' 3 HASH(0x83d8818) 'daemonPort' => 7500 'daemonProtocol' => 'tcp' 'httpPort' => 7580 'reliability' => 60 'startScript' => '/binlib/mdi/rv/etc/start_rvd' 'transmissionBus' => HASH(0x83d87b8) 'driverName' => 'sink,1' 'numBuffers' => 500 'version' => 6.9 4 'OUT' 5 HASH(0x83d6a7c) 'daemonPort' => 9575 'daemonProtocol' => 'tcp' 'httpPort' => 9590 'instanceName' => 'OUT' 'reliability' => 60 'startScript' => '/binlib/mdi/rv/etc/start_rvd' 'version' => 6.9 10 'instances' 11 ARRAY(0x83d67ac) 0 'rvd' 1 'rrcp' 2 'OUT'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How many levels of indirection in a Hash?
by Roy Johnson (Monsignor) on Jun 07, 2005 at 20:15 UTC | |
|
Re: How many levels of indirection in a Hash?
by demerphq (Chancellor) on Jun 07, 2005 at 22:02 UTC | |
|
Re: How many levels of indirection in a Hash?
by thundergnat (Deacon) on Jun 07, 2005 at 21:08 UTC | |
|
Re: How many levels of indirection in a Hash?
by cool_jr256 (Acolyte) on Jun 07, 2005 at 20:26 UTC | |
|
Re: How many levels of indirection in a Hash?
by crusty_collins (Friar) on Jun 07, 2005 at 20:32 UTC | |
|
Re: How many levels of indirection in a Hash?
by crusty_collins (Friar) on Jun 07, 2005 at 21:23 UTC | |
by Roy Johnson (Monsignor) on Jun 07, 2005 at 23:39 UTC | |
|
Re: How many levels of indirection in a Hash?
by crusty_collins (Friar) on Jun 08, 2005 at 01:02 UTC |