in reply to Re: Re: Backslash Interpolation
in thread Backslash Interpolation

Note that Data::Dumper produces Perl code so, if you give Data::Dumper a string with a single backslash in it, then it will display a string literal with the backslash escaped, that is, the output will contain two backslashes.

So I still think the slash is being lost before CGI.pm gets involved.

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

Replies are listed 'Best First'.
Re: (tye)Re: Backslash Interpolation
by Anonymous Monk on Jun 14, 2001 at 21:03 UTC
    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?

      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")