in reply to (tye)Re: Backslash Interpolation
in thread Backslash Interpolation

Ah that makes sense now. The Dumper output was throwing me.
I assume that the only reason \\ has to interpolate to \ because \' interpolates to ' .Otherwise my $var='\'; wouldn't compile.
Is there actually a real way of assigning a string literal without any interpolation occuring at all?

Replies are listed 'Best First'.
(tye)Re2: Backslash Interpolation
by tye (Sage) on Jun 14, 2001 at 21:13 UTC

    Yes, exactly. It is one of my pet peaves that q() makes \ special just for the sake of quoting a single character. In some ways I'd rather have ' be quoted by doubling it: 'This string isn''t ''valid'' in Perl'. But then things get really tricky if you try to extend that to deal with Perl's fancy delimiter schemes q(Too many ((s in string).

    The only quoting in Perl that doesn't treat \ as special is "here docs":

    my $string= <<"END"; Backslash (\) doesn't have to be doubled (\\) here. END
    That puts three backslashes into $string.

            - tye (but my friends call me "Tye")