in reply to Remove Extra bytes at end of file

My best guess is that the extra bytes could be the windows line feeds (\r\n).
Did you try running dos2unix on the file first? Is the cab file a plain text file?

Anyways, if you want to remove the characters manually, you could just use Tie::File and then chop($tied_file[-1]) twice.
Or slurp the thing into a scalar, chop twice, and then dump it back out to file.