J
jidanni
Regarding this hash of hashes on
$ man perldsc
%HoH = (
flintstones => {
lead => "fred",
pal => "barney",
},
jetsons => {
lead => "george",
wife => "jane",
"his boy" => "elroy",
},
simpsons => {
lead => "homer",
wife => "marge",
kid => "bart",
},
);
What command will tell me what I want to know: that there are 22 things
inside it? The following docs didn't help. Does one really need to write
a recursive program to finally get a "22"? I'm willing to take 19 for an
answer too, but not 3, or "2/8".
$ perldoc -q entries
$ man perldsc
%HoH = (
flintstones => {
lead => "fred",
pal => "barney",
},
jetsons => {
lead => "george",
wife => "jane",
"his boy" => "elroy",
},
simpsons => {
lead => "homer",
wife => "marge",
kid => "bart",
},
);
What command will tell me what I want to know: that there are 22 things
inside it? The following docs didn't help. Does one really need to write
a recursive program to finally get a "22"? I'm willing to take 19 for an
answer too, but not 3, or "2/8".
$ perldoc -q entries
elements==keys?!Found in /usr/share/perl/5.10/pod/perlfaq4.pod
How can I know how many entries are in a hash?
If you mean how many keys No I don't!!
$ perldoc -f length
Note that this cannot be used on an entire array or hash to find out
how many elements these have. For that, use "scalar @array" and
"scalar keys %hash" respectively.