Yes after looking at the project it was much simpler to just count the newlines before each print, and that is what I wound up doing. Thanks for the suggesstions and help. Here is a sample of what i wound up doing as far as the same FILEHANDLE, different file goes:
$filename = "MyJScript01.txt";
push(@filenames,$filename);
$filenumber = 1; #variable to track the filenames format: MyJscript#.t
+xt where # is a number
open (OUT,">$filename");
print OUT "<script language='JavaScript'>\n";
print OUT "function whichMapper(obj){\n";
print OUT "if(obj.selectLSO.selectedIndex == 1){\n";
$lineCounter = 3; #Track the number of newlines printed to the JS file
(other code with many prints each line incrementing $linecounter)...
if($lineCounter > 1000){
close OUT;
$filenumber += 1;
$filename = "MyJScript0".$filenumber.".txt";
push(@filenames,$filename);
open (OUT,">$filename");
$lineCounter = 0;
}
}
print OUT "}\n";
print OUT "</script>\n";
close OUT;
(at the end I do stuff with the files created)...
This is a snippet from a larger program, but basically what I was doing was creating a javascript file based on some data in a db. The file was being included into a dynamic webpage. The file apparently got too large an cause a buffer overrun in the include directive of the web server we use. so I just decided to break the file up into smaller files and include them in order. Wound up working fine.