in reply to Remove Extra bytes at end of file

If it is consistantly 2 bytes, and the program works if you remove them, then use truncate.

If you know how long the file is, use it on the filehandle before you close it.

If not, truncate $filename, -s( $filename ) - 2; after you've closed the filehandle might do the trick.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.