in reply to Can't get rid of \r

I ran into a similar problem a while ago. See the great replies I got in Newlines: reading files that were created on other platforms. In short, the options include using regexen to convert the newline characters, binmode, or File::LocalizeNewlines.