in reply to Problem with larger files (and s/)

The NOT\t\tNULL issue is trivially corrected with
if (not s/NOT NULL/\t\tNOT NULL/s) { s/NULL/\t\tNULL/s; }
(at least I hope so, didn't test it).

The following regex works too:

To find the solution to the other problem I would suggest loading that 9k file into an editor (not word, not wordpad, but you probably know that), cut it by half and feeding it to your program again. If the problem is still there when it is 300 bytes long you know it isn't because of size, but probably the wrong file format.

If not, put another print statement before all the regexp to see if perl reads the file incorrectly or mangles it in your code (which to me looks perfectly ok).