Each verse seems to have exactly one <p> - is this true?
| use XML::Parser; my $p = new XML::Parser Style => 'stream'; $p->parsefile($ARGV[0]); sub StartTag { my $expat = shift; my $type = shift; if ($type eq "v") { $pCount = 0; } elsif ($type eq "p" && grep(/^v$/, $expat->context)) { $pCount++; } } sub EndTag { if ($pCount > $maxPCount) { $maxPCount = $pCount; } } sub Text { } # default is to copy it through sub EndDocument { print "Max P's per V: $maxPCount\n"; } |