I tried the same thing on my UNIX machine to see what the difference might be, and I couldn't come up with anything. So, keep a few things in mind about Windows (partially OT, as it's more process maintenance and windowsism from this point on, but in this case, one may need to think outside the shebang):

Here is the code I used, you may wish to do the same:
#!/usr/bin/perl -w use strict; my $n=0;open(OUT,">$n.out"); while(<>) { print OUT or die "Lost file handle\n"; if (/foo/) {close(OUT);$n++;open(OUT,">$n.out") or die "Can't get file handle\n";} } print "Reached EOF\n"; close(OUT);
I used some web logs to test it, and it was fine. No huge memory consumption (and these are big logs), just did what it was supposed to do. If you are using Windows 2000 or NT, load up the process viewer and add in a file handles view, to make sure it isn't leaking them. Try the sleep(). Who knows, being a better OS citizen may actually work.

Good luck.

In reply to Re: Parsing large files by JayBonci
in thread Parsing large files by Spica

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.