Your approach seems pretty reasonable. Just one pointer:
{
local($/) = "...end of paragraph delimiter...";
while (<F>) {
my $line = process_paragraph($_);
print OUT2 $line;
}
}
This localizes the value of
$/ so that it gets reset upon leaving the block. It's a defensive measure so that you don't get surprised later on when you expect
$/ to contain the default value.
Also, note that in the while loop, $_ will contain the end of paragraph delimiter. You can chomp it or just leave it, depending on what your processing routine does.