Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my %Log_names = ( "BM_therm_boiler_00_state" => { 'events_log' => 1 }, "BM_therm_house_00_state" => { 'events_log' => 1 }, "BM_therm_hpump_00_state" => { 'events_log' => 1 }, "BM_swi_" => { 'device_log' => 1 }, );
I get the right result but it seems that keys are added to hash. Can I prevent this ?if exists $Log_names{"BM_light_test_00_"}{"device_log"}
How to properly check existence and retrieve its content from hash of hashes ?$VAR1 = { 'BM_light_test_00_' => {}, 'BM_swi_' => { 'device_log' => 1 }, 'BM_therm_house_00_state' => { 'events_log' => 1 }, 'BM_therm_boiler_00_state' => { 'events_log' => 1 }, 'BM_therm_hpump_00_state' => { 'events_log' => 1 } };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Checking existence in hash of hashes without adding entries
by ccn (Vicar) on Dec 19, 2008 at 21:20 UTC | |
|
Re: Checking existence in hash of hashes without adding entries
by holli (Abbot) on Dec 19, 2008 at 22:13 UTC | |
|
Re: Checking existence in hash of hashes without adding entries
by Your Mother (Archbishop) on Dec 19, 2008 at 22:29 UTC | |
|
Re: Checking existence in hash of hashes without adding entries
by lakshmananindia (Chaplain) on Dec 20, 2008 at 03:23 UTC |