Trying to run a simple perl script in command window and getting error: string terminator "'" anywhere before EOF at -e line 1
.
perl -e 'print "Hello World";'
What am I doing wrong?
Trying to run a simple perl script in command window and getting error: string terminator "'" anywhere before EOF at -e line 1
.
perl -e 'print "Hello World";'
What am I doing wrong?
Which platform? If it was Windows and CMD.EXE, then all sorts of things could be going wrong. On a Unix-like platform, that should work fine. No newline at the end, so it's likely your prompt would appear to start with 'Hello World', but that's all.
With the comment that it is Windows, then the trouble is that Windows CMD.EXE does not parse the command line the same as Unix, and you can't simply use single quotes around arguments; you have to use double quotes. Try:
There's a modest chance it will work for you.
From
perldoc perlfaq3
- Why don't Perl one-liners work on my DOS/Mac/VMS system?Try:
perl -e " print 'Hello..'; "
This works in the WindowsCMD.EXE
console where quoting is not POSIX standardized.