I have Hash where values of keys are other Hashes.
Example: {\'key\' => {\'key2\' => {\'key3\' => \'value\'}}}
How can I iterate throug
Also, please read through perldoc perldsc. You can learn about hashes in depth
This post may be useful.
foreach my $key (keys %hash) {
foreach my $key2 (keys %{ $hash{$key} }) {
foreach my $key3 (keys %{ $hash{$key}{$key2} }) {
$value = $hash{$key}{$key2}->{$key3};
# .
# .
# Do something with $value
# .
# .
# .
}
}
}
You will have to loop through it twice. i.e.
while ( ($family, $roles) = each %HoH ) {
print "$family: ";
while ( ($role, $person) = each %$roles ) {
print "$role=$person ";
}
print "\n";
}