in reply to Remove Carriage Return

Yes. This might be what you mean:
$string =~ s/\n//;
That will remove the first newline it sees. When mixing platforms you might have to deal with \r also. If you want to remove all the newlines add a g switch:
$string =~ s/\n//g;
Consider replacing the newline with something smaller, like a space.

So newline is a single character (at least on unix) and you can match it with \n.

Phil

Update: Hue-Bond pointed out an error in wording. The issue with \r arrises when you process a file on a different system than the one that generated it. Generally \n will match whatever the native new line combination is, but it will not necessarily match if the file came from a foreign system.

Replies are listed 'Best First'.
Re^2: Remove Carriage Return
by Hue-Bond (Priest) on Sep 16, 2005 at 20:31 UTC
    On non-unix boxes you might have to deal with \r also.

    I was taught that \n means "new line" so it maps to \x0a on Unix, \x0d on Macs and \x0d\x0a on Win*. Thus, it would be enough to get rid of \n.

    --
    David Serrano