thanks douglas. appreciate your help man. 'wish i can be as good as you.



----- Original Message -----
From: Douglas Wilson
To: Perl-Win32-Users Mailing List
Sent: Tuesday, May 09, 2000 9:13 AM
Subject: Re: Douglas:Newline & Carriage Return.


On 05/08/00, ""Jimmy S. Lim" <[EMAIL PROTECTED]>" wrote:
> hi,
> when you want to get rid of newlines and carriage returns, is it correct
to
> use:
> tr/\n&&\r//g; ?

That should work also except tr does not have a g modifier (
'd' deletes matching characters). You want to
read 'perldoc perlop' on 'tr'. Also I don't know why you have the
ampersands (&) in there.

Any of the escape sequences that work in a double quoted string should
work here (\r,\n,\t) but character classes that don't correspond to a
single character don't work (\s, \d, \w). Before I knew that, I just got
into the habit of using hex codes, especially for white space characters
(\x20 for space, \x09 for tab). If you use a Unix system, you can just
'man ascii' to get a chart of all the characters. Or it appears in alot of
computer related books.

> what does "x0a" and "x0d" mean?

Those are linefeed and carriage return, respectively.

> a few days ago, Bill suggested : tr/015d//g; to get rid of carriage
returns;

I think you mean tr/\033//d;, which is the equivalent
of tr/\x0d//d (33 octal is 0d hexadecimal). I happen to
like hex better. Read 'perldoc perlre' on all the sequences you can use.

Cheers,
Douglas Wilson

---
You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to
         [EMAIL PROTECTED]



---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to