I cannot get a Perl script to run

I cannot get a Perl script to run - the compiler will not even accept double quotes

iMac with Retina 5K display, OS X El Capitan (10.11.6)

Posted on Aug 20, 2016 10:51 AM

Reply
6 replies

Aug 21, 2016 12:01 AM in response to etresoft

Into a *.pl file I write ' open (REC,">>save.txt"); ' and get the response that there is an Unrecognized character \xE2; at the first double quote. Sorry to mention compiler rather that parser.


In fact the parser will not accept double quotes (i.e.. ") in any line and the simple ' print "Hello World"; is objected to also. Oddly the open file line I mention will pass if I use back ticks instead and the file is created. But using a line such as ' print REC"hello"; ' is not accepted whether using double or single quotes and with back ticks it is parsed but nothing gets written to the file.


In short the Perl5 is unusable?

Aug 21, 2016 7:35 AM in response to Newboy02

Use a "REAL" text editor. I suggest you try TextWrangler (free download) if you want to use a GUI based text editor

<http://www.barebones.com/products/textwrangler/>


If you do not want to download a very good text editor, then use 'nano' from a terminal session, or vim, or emacs, or if you must use TextEdit, make sure you change the file to a Plain Text File before you save it.


PS. You perl statement works just fine on my Mac, when I put it into a file using

echo 'open (REC,">>save.txt");' >tmp.pl

perl tmp.pl

# no error reported

echo $?

0

# completion status was success

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

I cannot get a Perl script to run

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.