in reply to Re: Program Not Found when run from browser page
in thread Program Not Found when run from browser page

Don't forget to put double \\ because \ is an escape character, it must be doubled for it to produce a single \
Ignoring all the rest of that but you could avoid interpolation by using single quotes.
  • Comment on Re^2: Program Not Found when run from browser page

Replies are listed 'Best First'.
Re^3: Program Not Found when run from browser page
by LanX (Saint) on Nov 13, 2024 at 21:45 UTC
    Escapes are not a matter of interpolation.

    Even inside single quotes you'll need to double backslashes, otherwise it wouldn't be possible to escape a single quote.

    Consider 'O\'Reilly'

    Probably you are confusing it with the worse "slasheritis" in other languages.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

      In fact, no. If the path doesn't contain single quotes, you don't need to double the backslashes:

      $ perl -wE 'say q(C:\Windows\System)' C:\Windows\System

      I agree it's not exactly interpolation, but still.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
        Yeah, it's true, you don't need to double the backslash if they are enclosed in single quotes or q(), however if the backslash happens to be the last character in the string, then it must be double. So, it's just easier to remember to always double it.

        Incorrect: 'C:\Windows\'

        Correct: 'C:\Windows\\'

        Incorrect: q(C:\Windows\)

        Correct: q(C:\Windows\\)

        This is easier to rememeber: 'C:\\Windows\\' or "C:\\Windows\\"