in reply to RE: RE: RE: slash converter
in thread slash converter

Of course, you can avoid escaping back-slashes by putting everything in single-quotes, but that makes variable interpolation somewhat messy.

Replies are listed 'Best First'.
RE (tilly) 5: slash converter
by tilly (Archbishop) on Oct 13, 2000 at 22:34 UTC
    One of the (for me) more annoying gotchas. Inside a single-quoted string, \ is still special. '\\' is just a single \, and '\'' is a single-quote.

    So if you need to, by chance, wind up with \\, even with a single quote you still find yourself doing \\\\.

      Weird..
      $ cat test $var = 'c:\test\file.txt'; print "$var\n"; $ perl test c:\test\file.txt
      Update: My bad; I see what you're saying.. It needs to examine \ because you may need single-quotes in your single-quoted string.
      print '\\'; # prints "\" not "\\"