Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: XML::LibXML count nodes

by Lotus1 (Curate)
on Nov 17, 2011 at 19:10 UTC ( #938668=note: print w/replies, xml ) Need Help??


in reply to XML::LibXML count nodes

Try this:

print scalar(@{$doc->findnodes('//category')});

I've done it by assigning the nodes to an array and then just printing the number of elements in the array.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://938668]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2017-11-18 06:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (277 votes). Check out past polls.

    Notices?