You're missing a decent shell with sane and well-defined quoting rules. On Windows, only the double quote is considered a quote, and the escaping rules are poorly defined and inconsistent. Try:
perl -e "print qq{Hello World \n}"
I strongly recommend avoiding anything but the very simplest one-liners on Windows. (Another problem with Windows one-liners is that the Windows shell doesn't expand wildcards. If you use *.txt
on the command line, it'll look for a file named literally *.txt
. You'll run into that later.)
On Windows, what you typed is equivalent to:
perl -e "'print" "Hello World \n'"
That is, the code Perl is trying to execute is 'print
with @ARGV
containing the single string Hello World \n'
. (That's not a newline, that's a backslash followed by n
).