in reply to ^M chars in output file

locust:

Use binmode on your file handles so you'll only get the "\r" characters when you want to write them them. Also, for trimming the end of lines, I typically use s/\s+$//, because it'll remove *all* of the junk at the end that I don't care about.

...roboticus

Replies are listed 'Best First'.
Re^2: ^M chars in output file
by locust (Sexton) on Nov 22, 2010 at 15:57 UTC

    roboticus:

    This worked, however, it's important to point out that one must use binmode on both the input AND output file. This drove me nuts for awhile until I put the obvious together.

    After reading the doc on binmode I gathered that Perl will automatically put the appropriate new line char at the end of the line for os your using.

    Thanks