nested hash
From: lyoute (lyoute_at_softhome.net)
Date: 05/27/04
- Next message: Gunnar Hjalmarsson: "Re: nested hash"
- Previous message: Hans van Vooren: "Usage of --help and --version in getopts()"
- Next in thread: Gunnar Hjalmarsson: "Re: nested hash"
- Reply: Gunnar Hjalmarsson: "Re: nested hash"
- Reply: ! aaa: "Re: nested hash"
- Reply: Joe Smith: "Re: nested hash"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 27 May 2004 21:28:24 +0800
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?
- Next message: Gunnar Hjalmarsson: "Re: nested hash"
- Previous message: Hans van Vooren: "Usage of --help and --version in getopts()"
- Next in thread: Gunnar Hjalmarsson: "Re: nested hash"
- Reply: Gunnar Hjalmarsson: "Re: nested hash"
- Reply: ! aaa: "Re: nested hash"
- Reply: Joe Smith: "Re: nested hash"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]