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.

In reply to Re^2: Tracking Lines Printed to a FileHandle by ketema
in thread Tracking Lines Printed to a FileHandle by ketema

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.