D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
blackhat.pw
:
/
kunden
/
kunden
/
usr
/
share
/
doc
/
libxml-sax-expat-perl
/
examples
/
Filename :
counter.pl
back
Copy
#!/usr/bin/perl -w use strict; use warnings; use XML::SAX::Expat; sub Counter::new { bless { count => 0 }, shift } sub Counter::start_element { shift->{count}++ } if (@ARGV != 1) { print "Usage: $0 example.xml\n"; exit; } my $counter = Counter->new; my $parser = XML::SAX::Expat->new(Handler => $counter); $parser->parse_file($ARGV[0]); printf "%s has %d elements\n", $ARGV[0], $counter->{count};