[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Stripping Carriage Returns



A few days ago I asked a question about stripping tabs out of inputted
text.  Thankfully, Chris provided that answer which was:

$text  =~ s/\t//g;

This worked so well, I thought I would use it to strip out carriage
returns.  No such luck.  I tried

$text =~ s/\n/ /g;

I get rid of the returns but get:

this^M is^M a^M test

when I input

this
is
a
test

Where does the ^M come from and how do I strip it out.  I tried the
obvious which was

s/^M//g;

but that did not work.  Is this a Mac thing?  My input is coming from
NS4.03 (Mac version, of course).

Any help on this matter is greatly appreciated.


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch