Perl seems to have broken: "=: not found" and "package: not found"
I have a perl script; on my personal machine, running the exact same version of perl (5.10.1), it runs perfectly fine. However, on the server machine, it not only doesn't run, it gives me odd errors. It ran fine until recently, and I did check that the packages required are installed.
The beginning of the script (where it chokes):
#!/usr/bin/perl
package Hermes;
$VERSION = 3.5;
use FindBin qw($Bin);
push @INC,$Bin;
push @INC ,"/usr/local/lib/perl5/site_perl/5.10.1/";
require("Hermes_config.pm");
$install_Directory = $Config::install_Directory;
push @INC,$install_Directory; #Fix for running from rc.local
use warnings;
#use strict;
use Safe;
use POE;
use POE::Component::IRC;
use Module::Reload;
use Math::Expression::Evaluator;
The output:
Hermes3.0/hermes3.5.pl: 17: package: not found
Hermes3.0/hermes3.5.pl: 18: =: not found
Hermes3.0/hermes3.5.pl: 20: Syntax error: "开发者_开发问答(" unexpected
(there's 15 lines of commented open-source copyright notice before the program begins, hence the line numbers).
POE, Module::Reload, and Math::Expression::Evaluator are installed (according to instmodsh), cpan tells me FindBin is up to date, reinstalling Safe didn't help, so it doesn't seem to be a missing package - besides which, it's not telling me a package name that's missing, it appears to be choking on the word "package". Reinstalling Perl didn't help (using apt-get install --reinstall perl).
I recently upgraded the machine's version of ubuntu; it's very possible that messed something up, so any hint as to where to start looking would be appreciated.
The issue is that bash is trying to run/compile/interpret the script, rather than perl.
#! /usr/bin/perl
should be at the very top of your file, don't have stuff above it.
精彩评论