I believe that what my application requires is a hash of hashes that
each reference an array of hashes. What is the best way to rewrite
this structure or the access to it so that I do not need one foreach
within another?
#!/usr/bin/perl -w
use Strict;
my %cfg = (
"outer_key1" =>
{ "inner_key1" =>
[
{ dir => "the_value_I_want",
},
{ dir => "another_value_I_want",
},
],
},
"outer_keyN" =>
{ "inner_keyN" =>
[
{ dir => "the_value_I_want",
},
{ dir => "another_value_I_want",
},
],
},
);
my $cfgs = $cfg{'outer_key'}{'inner_key'};
# I would like to be able to use
# if( ! defined( $cfgs ))
# or something here to detect an error condition and abort.
foreach my $item ( @$cfgs )
{
foreach my $inner ( $item )
{
print "Inner : $inner->{'dir'}";
}
}
__END__
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]