Perl Escape Characters

Within a transliteration, the first ten of these sequences may be used.

 \t tab (HT, TAB)
 \n newline (NL) may not be carrage return + line feed.
 \r return (CR) may not be the ascii carrage return
 \f form feed (FF)
 \b backspace (BS)
 \a alarm (bell) (BEL)
 \e escape (ESC)
 0円oo oo=octal ASCII char value e.g. form feed (\f) is 014円
 \xhh hh=hex ASCII char value e.g. form feed (\f) is \x0C
 \c[ [=control char e.g. form feed (\f) is \cL
 \l lowercase next char
 \u uppercase next char
 \L lowercase till \E
 \U uppercase till \E
 \E end case modification
 \Q quote non-word characters till \E

If use locale is in effect, the case map used by \l, \L, \u and \U is taken from the current locale. See the perllocale manpage.

All systems use the virtual "\n" to represent a line terminator, called a "newline''. There is no such thing as an unvarying, physical newline character. It is an illusion that the operating system, device drivers, C libraries, and Perl all conspire to preserve. Not all systems read "\r" as ASCII CR and "\n" as ASCII LF. For example, on a Mac, these are reversed, and on systems without line terminator, printing "\n" may emit no actual data. In general, use "\n" when you mean a ``newline'' for your system, but use the literal ASCII when you need an exact character. For example, most networking protocols expect and prefer a CR+LF ( "012円015円" or "\cJ\cM") for line terminators, and although they often accept just "012円", they seldom tolerate just "015円". If you get in the habit of using "\n" for networking, you may be burned some day.

Comments:


file: /Techref/language/perl/litesc.htm, 2KB, , updated: 2009年4月27日 20:15, local time: 2025年9月5日 05:29,
40.74.122.252:LOG IN

©2025 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.org/techref/language/perl/litesc.htm"> Perl Escape Characters</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here:
if you want a response, please enter your email address:
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

Welcome to massmind.org!

Welcome to massmind.org!

.

AltStyle によって変換されたページ (->オリジナル) /