in reply to Text Manipulation

As YuckFoo said, give binmode a look if you're on Win32. I've been surprised quite a few times by my scripts mysteriously quitting in the middle of a file just because I didn't use binmode. Not a problem on strait and narrow text files, but it seems like you're dealing with some weird characters, so that could be a problem.