in reply to Getting Keys From Hash In a Hash
Like this:
You can also check perldsc. or **Specifically: Access and Printing of a HASH OF HASHESmy %form; my %field = ( 'key 1' => 'value 1', 'key 2' => 'value 2', ); $form{another_hash} = \%field; for my $first_key ( keys %form ) { for my $hoh_keys ( keys %{ $form{$first_key} } ) { print $hoh_keys, $/; ## get the keys } }
You really can use Data::Dumper to see how the data structure looks like, then you can get at what you want.
produces..use Data::Dumper; ... print Dumper \%form;
** Updates.$VAR1 = { 'another_hash' => { 'key 2' => 'value 2', 'key 1' => 'value 1' } };
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Getting Keys From Hash In a Hash
by HalNineThousand (Beadle) on Aug 08, 2013 at 19:25 UTC |
In Section
Seekers of Perl Wisdom