At 11:10 AM -0700 5/26/11, Derek wrote:
Hello, I am getting the following error:

bash: /var/www/html/bugzilla/email_in.pl: line 2: syntax error near
unexpected token `('
bash: /var/www/html/bugzilla/email_in.pl: line 2: `use Cwd
qw(abs_path);'

The contents of this file are:

#!/usr/bin/perl
use Cwd qw(abs_path);

Thats all. I know basically nothing about perl. I am a Java programmer
mostly. I am getting this same problem in the bugzilla email_in.pl
scripts. So I trimmed it down to the shortest amount of lines that
seem to be the problem. I tried to look up what the lines are doing
but I cant figure it out why its complaining of an error.

I can run this on the command line with no errors:

perl -e 'use Cwd qw(abs_path);'

Why would I not be able to run this in a script but I can on the
command line?

Because bash is not running the Perl interpreter, but trying to execute the file as bash commands. That is why the first part of each error line is "bash:". Something is wrong with your first line. Try this:

perl /var/www/html/bugzilla/email_in.pl: line 2: syntax error near

and see what you get.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to