");
CHAPTER: foreach my $chapter(1..1000){
print("Processing $bookname_infile_A and $bookname_infile_B chapter $chapter.\n");
my $chapter_header_written;
my $verse_found;
VERSE: foreach my $verse(1..1000){
my $colBcontentTMP;
my @verseContentA = &grabVerseContent($bookname_infile_A, $chapter, $verse, @BUFA);
($colBContent) and $colBcontentTMP = 1;
my @verseContentB = &grabVerseContent($bookname_infile_B, $chapter, $verse, @BUFB);
($colBContent) and $colBcontentTMP = 1;
if (@verseContentA or @verseContentB) {
if (not $chapter_header_written) {
push(@result, "
");
$chapter_header_written = 1;
}
push(@result, "");
$verse_found = 1;
}
else{ #verse nonexistent, goto next chapter
if ($chapter_header_written) { push(@result, ""); }
last VERSE;
}
if (@verseContentA){
if (@verseContentB){ push(@result, "
" . $variantNameA ."\n") };
push(@result, "");
if (@verseContentB){ push(@result, " | ") };
}
if (@verseContentB){
if (@verseContentA){ push(@result, $variantNameB . "\n") };
push(@result, "");
if (@verseContentA){ push(@result, " |
") };
}
if ($verse_found){ push(@result, "") }
}
if (not $verse_found){ #chapter empty, stop here
if ($chapter == 1) { die("Error: no content in $bookname_infile_A and $bookname_infile_B"); }
last CHAPTER;
}
}
push(@result, "
"); #book
print("done.\n");
return(@result);
}
sub loadFile(){ #$fileName loads the file into the buffer and makes small corrections
my $filename = shift;
open( FILE, "$prefix/$filename") or die("Could not open file $prefix/$filename");
my @buffer =