in reply to Remove Carriage Return
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//;
Consider replacing the newline with something smaller, like a space.$string =~ s/\n//g;
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 |