Why doesn't this Perl one-liner work on Windows?

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?

Answers


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:

perl -e "print qq{Hello World\n}"

There's a modest chance it will work for you.


Need Your Help

Security: two app dealing via api

api security rest http authentication

I have 2 app. First app (A) has client side (HTML) and server side (RUBY, PHP or something else). Second app (B) is an API. Everything is through https. Consider this scenario:

Rails: has_many through association, and the form for creating new instances

ruby-on-rails

I'm still super new with Rails, and just trying to get my first has_many through association set up.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.