Is Microsoft Windows involved? Windows implementations will add a "\r" if you are sending text. This can be avoided by using
binmode on the file handle.
That is assuming you are using a filehandle. I have to guess here, because you don't show any code.