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

Re: [MacPerl] escape oddities...



At 13.32 -0500 1999.02.09, Scott Prince wrote:
>>But I don't know what you are saying the problem is.  You're saying that
>>\n's or \r's are in the text?  They shouldn't be.  Whatever your newline
>>characters are, for Mac, Unix, or Windows, s/\r|\n/ /g or s/[\r\n]/ /g
>>would remove them all.
>
>No they weren't there, but there was a character that was translated by
>Fetch as a \n that was not a \n. A bug in Fetch, the result of the way
>the character was interpreted by a platform, due to a bug in my script? I
>really don't know and haven't been able to reproduce it. It wasn't a
>problem, just an annoyance. Viewing the file with Fetch clearly showed
>the database records broken mid-field with a \n, but the script(on unix -
>admittedly slightly off topic) churned out the records properly
>nonetheless. This would of course be impossible if there were actually a
>\n in a database field.

But it's not shown up again?  Hm.  Oh well.  :)

>>>The book, "Perl5 by Example" has a table listing all the usual escape
>>>char's, but, further into the book there is a code example using the
>>>escape /cM. A quick test verifies that MacPerl recognizes this as a /r.
>>
>>No.  MacPerl sees \cM as \n, and \cJ as \r.  Unix and Windows do the
>>opposite.
>
>\cM, \cJ? I have rarely seen these. Just out curiosity, where could I
>find a list of every possible escape sequence recognized by Perl?

\cM means carriage return, \cJ means linefeed.  There is no list of every
possible sequence, really, unless you have a list of all octal and hex
sequences.  And Unicode is around the corner, which adds more.

Stick with octal or hex and you'll be fine (except for \n, and in the case
of regexes, the regex metacharacters listed in the perlre man page).  I
only mentioned \cM because you mentioned its use.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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