in reply to is "\" a special character when using substrings??

It is a 'special' character when in double quotes or in regular expressions. In those cases you need two backslashes. And see perldoc perlre.
  • Comment on Re: is "/" a special character when using substrings??

Replies are listed 'Best First'.
Re: Re: is "/" a special character when using substrings??
by tye (Sage) on Jun 19, 2001 at 02:03 UTC

    Don't forget that \ is also special inside single quotes. It is special in all of Perl's quote-like operators except for qw() and single-quoted here-docs (so that adds qx(), tr///, and double-quoted and back-quoted here-docs). (updated)

            - tye (but my friends call me "Tye")
      I'm going to assume that this is true of at least 5.6 and beyond, or that I'm finding a bug here:
      C:\>perl -v This is perl, version 5.005_02 built for MSWin32-x86-object ... C:\>perl print 'hello\n'; print "hello\n"; ^D hello\nhello C:\>

      Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

        I said \ is special inside single quotes. I didn't say that \n means newline inside of single quotes. Try this:

        print '\\'; print '\'';

        Update: The canonical test for whether \ is special is to see if \\ ends up giving you one \ or two.

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