/usr/share/doc/libxml-sax-expat-perl/examples/counter.pl is in libxml-sax-expat-perl 0.40-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #!/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};
|