Re: String Literals, take 3
[email protected] (Andrew Wilson) Thu, 5 Dec 2002 15:46:25 +0000
| Newsgroups | perl.perl6.documentation |
|---|---|
| Message-ID | <[email protected]> |
--1ccMZA6j1vT5UqiK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Thu, Dec 05, 2002 at 09:23:09AM -0600, Jonathan Scott Duff wrote:
> On Thu, Dec 05, 2002 at 12:27:16PM +0000, Andrew Wilson wrote:
> > On Thu, Dec 05, 2002 at 02:59:32AM -0500, Joseph F. Ryan wrote:
> > > Non-Interpolating constructs are strings in which expressions do not
> > > interpolate or expand. The exception to this rule is that the
> > > backslash character, \, will escape the character that immediately
> > > follows it.
> >=20
> > I don't think this is right. A single backslash which is not followed
> > by the current quoting delimiter, or the characters q[ or q[[ is not
> > special. It will not escape the following character, it just appears in
> > the string. How about this:
>=20
> Actually, I think what you just said above is better. Here's that
> plus my own ramblings:
>=20
> Non-Interpolating constructs are strings in which expressions do
> not interpolate or expand. The exception to this rule is the
> backslash character C<\>. A single backslash which is followed
> by the current quoting delimiter, or the characters q[ or q[[ is
> special (more on this below). In all other cases the backslash
> just means "literal next character". This is so that you can
> easily get a backslash within your non-interpolating strings.
> For instance, 'backslash (\\) \test' becomes "backslash \ test".
Except that not what it does. Try this
perl -we "print '\a'.qq{\n}"
you should get:
\a
=20
Non-Interpolating constructs are strings in which expressions do
not interpolate or expand. The exception to this rule is the
backslash character C<\>. A single backslash which is followed by
another backslash, the current quoting delimiter, or the
characters q[ or q[[ is special (more on this below). In all
other cases the backslash just means "literal backslash". This is
so that you can easily get a backslash within your
non-interpolating strings. For instance, 'backslash (\\) \test'
becomes "backslash (\) \test".
> <barbie>writing is hard!</barbie> :-)
Yes it is.
andrew
--=20
Capricorn: (Dec. 22 - Jan. 19)
Remember: Doing the right thing is nowhere near as important as whether
others think you're cool.
--1ccMZA6j1vT5UqiK
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE973TR4x3z39L355MRAmfuAKCZS3Bo8qVxklWC3+siLv9KTp3HtQCfT8tv
NmgiFV6C0EM3i5or9DZ6YH4=
=FxSP
-----END PGP SIGNATURE-----
--1ccMZA6j1vT5UqiK--