L
lyoute
hi,
i got a hash like:
$hello{key1s}->{key2s}->{'attr1'}
$hello{key1s}->{key2s}->{'attr2'}
i tried:
$hello{'a1'}->{'aa2'}->{'attr1'} = "abc1";
$hello{'a1'}->{'aa2'}->{'attr2'} = "abc2";
$hello{'a1'}->{'aabc2'}->{'attr1'} = "blah1";
$hello{'a1'}->{'aabc2'}->{'attr2'} = "blah2";
$hello{'b1'}->{'b2'}->{'attr1'} = "foo1";
$hello{'b1'}->{'b2'}->{'attr2'} = "bar2";
foreach $k1 (keys(%hello) ) {
print "$k1\n";
#i can get all the key1s, but how can i get key2s?
#i tried :
# foreach $k2 ( keys( %($hello{$k1}) ) {
# }
#but didn't work
}
how can i get the key2s?
i got a hash like:
$hello{key1s}->{key2s}->{'attr1'}
$hello{key1s}->{key2s}->{'attr2'}
i tried:
$hello{'a1'}->{'aa2'}->{'attr1'} = "abc1";
$hello{'a1'}->{'aa2'}->{'attr2'} = "abc2";
$hello{'a1'}->{'aabc2'}->{'attr1'} = "blah1";
$hello{'a1'}->{'aabc2'}->{'attr2'} = "blah2";
$hello{'b1'}->{'b2'}->{'attr1'} = "foo1";
$hello{'b1'}->{'b2'}->{'attr2'} = "bar2";
foreach $k1 (keys(%hello) ) {
print "$k1\n";
#i can get all the key1s, but how can i get key2s?
#i tried :
# foreach $k2 ( keys( %($hello{$k1}) ) {
# }
#but didn't work
}
how can i get the key2s?