http://qs321.pair.com?node_id=972034


in reply to Help with problem

A wild guess: Since you reopen FILEOUT to a new file without closing it first, maybe there's an issue with some buffered data ending up in the wrong file? I think perl is usually smart about closing file descriptors in cases like that, but I don't know if you can always count on it. Perhaps you should close it before reopening it.

Aside from that, I'd have to agree with moritz: some issue with testing. Maybe whatever you're using to count the lines in your resulting files doesn't have exactly the same definition for "line" that perl does. Incidentally, there is a perfectly good *nix utility for this kind of thing:

grep -v ^$ inputfile | split -d -l 300000 - outputfile

Aaron B.
Available for small or large Perl jobs; see my home node.