On Sep 3, 9:03 am, [EMAIL PROTECTED] (Beginner) wrote:
> On 3 Sep 2007 at 13:38, Andrew Curry wrote:
>
> > The problem is its unclear, its always better to be clear in code. It will
> > also remove any formatting from the end of lines. If you wanted to be just
> > as crude you can use chomp.
>
> I paritally agree that it could be un-clear. Perhaps
>
> s/\s+$//;               # Remove all \r, \n, ^M from end of line
>
> would be clearer.
>
> I got this solution from this list because I suffered from this same
> problem a lot and chomp was not working as expected. It would leave a
> character on the end that still interpreted as a newline by the
> shell. When that happened, in the context of a file-system lookup,
> the results were baffling.
>
> Dp.

only use vi:

:%s/\r\n/\r/g

it can clean ^M perfect.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to