LeBreton has asked for the wisdom of the Perl Monks concerning the following question:

Hi, i have a problem, i'm on Windows 7 with Strawberry Perl. I do : C:\Users\Documents>perl -e 'print "A"' Can't find string terminator "'" anywhere before EOF at -e line 1. I'm not a specialist of Perl, so what do i have to do to make this work ? Thanks for your help !

Replies are listed 'Best First'.
Re: Problem with perl one-liner
by Corion (Patriarch) on Apr 21, 2018 at 15:40 UTC

    The problem is more with your shell and less with Perl.

    cmd.exe does not understand single quotes for parameters, only double quotes. So, you need to use double quotes for your Perl oneliner:

    perl -e "print qq(A)"

    If you want to use double quotes within your Perl oneliner, I recommend using qq() instead. See perlop for more information on quote and quote-like operators.

Re: Problem with perl one-liner
by pryrt (Abbot) on Apr 21, 2018 at 15:39 UTC
    With Windows command line, outer quotes need to be double-quotes...
Re: Problem with perl one-liner
by NetWallah (Canon) on Apr 21, 2018 at 16:56 UTC
    This article on StackOverflow describes how WIndows cmd handles quotes, and provides some info on the subtle inconsistencies.

                    Memory fault   --   brain fried