in reply to Single quoting weirdness

Well, there is one way that you can avoid the \\ rule in strings. Use the single quote variant of heredocs. as in the following
print join("\n",split(/\s+/,<<'END_OF_TEXT'); + \+ \\+ \\\+ END_OF_TEXT
which outputs
+
\+
\\+
\\\+
Yes its annoying but single quoted here docs are the _only_ way (without using deep voodoo) to quote backslashes without escaping them.

Updated in respect for Abigail-II

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.

Replies are listed 'Best First'.
Re: Single quoting weirdness
by Abigail-II (Bishop) on Jun 07, 2002 at 14:14 UTC

    The _only_ way? Hah. You don't know Perl (yet) ;-).

    If you don't like the way Perl interpolates strings, Perl let's you change them.

    Abigail

    #!/usr/bin/perl use strict; use warnings 'all'; use overload; BEGIN { overload::constant q => sub {$_ [$_ [2] && $_ [2] eq 'q' ? 0 : 1]} +; } print '+ \+ \\+ \\\+', "\n"; print "+ \+ \\+ \\\+", "\n"; __END__ + \+ \\+ \\\+ + + \+ \+