in reply to Re^2: XML Attribute vs Element
in thread XML Attribute vs Element
You should probably change
my $count = scalar keys %{ $doc };
to
my $count = scalar @{ $doc->{$sub1} };
And similarly for your other counts.
Update: no, your other counts are fine. And you don't need the scalar as you are assigning to a scalar, so you can do as you have done for the other counts:
my $count = @{ $doc->{$sub1} };
|
|---|