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

Re: [MacPerl] Stripping Carriage Returns



On Mon, 04 May 1998, Jon Jacob and Joetta Moon wrote:

>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.

An alternative to the above code line (faster?) would be

	$text =~tr/\t//d;

As for CR's (^M as you say), try "\r". As a matter of fact this line
will replace tabs, newlines CR's and spaces to one single space:

	$text =~ tr/\n\r\t / /s;

Which might be useful. Sorry for the off-topic post ;-), but it seemed
like the best way to get this over with, fast.

	Bart.

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