gnu@perl has asked for the wisdom of the Perl Monks concerning the following question:
I have the following hash of hashes:
I want to do this:my %switch_hash = ( chrdex => { DEX => { '01-AUG-02' => 1, '03-AUG-02' => 3, } }, uslcgb5e2sm =>{ Greensboro => { '4-AUG-02' => 1, '6-AUG-02' => 2, } }, uslecat25e1 => { 'Atlanta II' => { '1-AUG-02' => 1, '2-AUG-02' => 3, '3-AUG-02' => 1, '4-AUG-02' => .25, } }, ); $rhent = \%switch_hash;
and I get this error:my @dates = ( keys %{(keys %{(keys %$rhent)})} );
Can something like this be done to get the key containing the date from the final hash? NOTE: There is a reason for using a reference, but that is beyond the scope of this question.Can't use string ("3") as a HASH ref while "strict refs" in use at ./x +cl3.pl line 301
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: using 'keys' recursively on a hash of hashes
by Abigail-II (Bishop) on Aug 21, 2002 at 13:48 UTC | |
Re: using 'keys' recursively on a hash of hashes
by fruiture (Curate) on Aug 21, 2002 at 13:51 UTC | |
Re: using 'keys' recursively on a hash of hashes
by krisahoch (Deacon) on Aug 21, 2002 at 14:21 UTC | |
by Anonymous Monk on Aug 22, 2002 at 05:47 UTC | |
by Abigail-II (Bishop) on Aug 22, 2002 at 08:59 UTC | |
Re: using 'keys' recursively on a hash of hashes
by physgreg (Scribe) on Aug 21, 2002 at 14:10 UTC | |
Re: using 'keys' recursively on a hash of hashes
by gnu@perl (Pilgrim) on Aug 22, 2002 at 20:13 UTC |
Back to
Seekers of Perl Wisdom