On Tue, May 21, 2002 at 11:03:42AM +0100, Nicholas Clark wrote:
> I believe that the correct rule for single quote context in perl should have
> been that backslash followed by anything is that thing.
That leaves Win32 users stuck in the same rut as now:
print 'c:\\it\'s\\going\\to\\be\\hard\\to\\read\\win32\\paths';
Read on.
> It's easier than the current one - backslash followed by backslash or the
> opening or closing delimiter is that thing, else it's backslash followed by
> that thing. Because to parse the contents of a string with this rule, you
> have to know what delimiter is.
Here's an easier one: backslash followed by the delimiter is that thing.
Everything else is literal.
print 'c:\it\'s\easier\to\write\win32\paths\this\way';
print q{this is ok { and so is \} } C:\this };
there's no need to backwack a lone backslash in single-quote context since
there's no ambiguity. It's trivial for the parser to figure out what the
terminating delimiter, in fact, it *has* to know else it can't terminate the
string! So there's no extra work for the parser.
The rule can be stated here clearly: Backwack the delimiter.
--
This sig file temporarily out of order.