Re: RFC 328 (v1) Single quotes don't interpolate \' and \\
[email protected] (Hildo Biersma) Fri, 29 Sep 2000 09:58:45 +0100
| Newsgroups | perl.perl6.language.data |
|---|---|
| Organization | Morgan Stanley Dean Witter & Co. |
| Message-ID | <[email protected]> |
> =head1 ABSTRACT > > Remove all interpolation within single quotes and the C<q()> operator, to > make single quotes 100% shell-like. C<\> rather than C<\\> gives a single > backslash; use double quotes or C<q()> if you need a single quote in your > string. Single-quoted strings need to be able to contain single quotes, which means some escape mechanism is required. So, $line = 'This string contains both single \' and double " quotes'; needs an escape. It would be silly to have an escape character different from the backslash that everything else uses. We also need to be able to do: $line = 'This single-quoted string ends on a backslash \'; Oops. Which is why that is spelled: $line = 'This single-quoted string ends on a backslash \\'; Again, the same escape mechanism is used. Conceivably, we could say that \\ in the middle of a single-quoted string is not escaped, i.e. it means two backslashes, that that way lies madness. So, I'd say, leave single quotes as they are. The two escapes are useful and required, as I've demonstrated above. Hildo