in reply to how to escape eof - chr(26)?

The problem isn't putting the string into the file, I think. The problem is confirming that the string got into the file. With your example, assuming all 12 characters get written to the file, using the DOS 'type' command (or any DOS-based program, like 'edit') will stop reading at the EOF character (chr(26)). Also, if you open the file from perl (or C++, etc.) in text mode, you won't see anything after the EOF, whther or not it's there.

Opening the file in binary mode for writing can't hurt either.

dmm

If you GIVE a man a fish you feed him for a day
But,
TEACH him to fish and you feed him for a lifetime