It seems that there's one paragraph per verse (stupid); is this true?
use XML::Parser; my $p = new XML::Parser Style => 'stream'; parsefile $p $ARGV[0]; sub StartTag { if ($_[0] eq "v") { $pCount = 0; } elsif ($_[0] eq "p" && grep(/^v$/, @{$p->{Context}})) { $pCount++ }; } sub EndTag { if ($pCount > $maxPCount) { $maxPCount = $pCount; } } sub Text { } sub EndDocument { print "Max P's per V: $maxPCount\n"; } |