in reply to Splitting long file

A potential problem with your code was that it leaves open a whole bunch of file descriptors (about 22,001) because you didn't close <B>, while it only has to have 2 open file descriptors at a time. Most OSs (all?) have a maximum amount of file descriptors that can be open at a given time.
Hope this helps avoiding this the next time.

Replies are listed 'Best First'.
Re: Re: Splitting long file
by tilly (Archbishop) on Apr 08, 2004 at 15:34 UTC
    Perl is smart enough to close the old file when you open another file on the same filehandle, therefore this isn't a problem.
      then I've learned something from this thread as well. Thanks tilly!
        It would be a problem in my solution below if I did not have the 'close' statement.