I'm responding again to this idea because your suggestion gained traction with me as I puzzled out a solution. I managed to eliminate the counters, as you suggested, and the code executes more efficiently now. Here's what that portion is now reduced to:
next if ( ($regex1)
&& ( (($accpyn1) && ($line1 !~ m/$regex1/o))
|| (!($accpyn1) && ($line1 =~ m/$regex1/o)) )
);
next if ( ($regex2)
&& ( (($accpyn2) && ($line2 !~ m/$regex2/o))
|| (!($accpyn2) && ($line2 =~ m/$regex2/o)) )
);
next if ( ($regex3)
&& ( (($accpyn3) && ($line3 !~ m/$regex3/o))
|| (!($accpyn3) && ($line3 =~ m/$regex3/o)) )
);
next if ( ($regex4)
&& ( (($accpyn4) && ($line4 !~ m/$regex4/o))
|| (!($accpyn4) && ($line4 =~ m/$regex4/o)) )
);
And with that logic, the counters became unnecessary. So thank you for the suggestion--it has been put to practical use.