在以下 perl 脚本中,
#!/usr/local/bin/perl
use Env;
use strict;
use warnings;
my $oscar_file = "input/oscar_single_piminus_1k.input";
my $PISAEvent_file = "output/PISAEvent_piminus_1k.root";
my %pisa_input = "pisa_piminus_1k.input" ;
my %pisa_start = "pisa < pisa_piminus_1k.input";
my $nevents = 1000;
open(INPUT, ">" . $pisa_input);
print INPUT "0\nN\n0\n";
close(INPUT);
open(INPUT2,">glogon.kmac");
print INPUT2 "macro glogon.kumac\npisafile $PISAEvent_file\ntext_file $oscar_file -1 1\nptrig $nevents\nexit\nreturn\n";
close(INPUT2);
my $ret = system($pisa_start);
它返回以下错误,
Global symbol "$pisa_input" requires explicit package name at pisa.pl line 26.
Global symbol "$pisa_start" requires explicit package name at pisa.pl line 32.
Execution of pisa.pl aborted due to compilation errors.
注释掉“使用严格”没有帮助,
Name "main::pisa_input" used only once: possible typo at pisa.pl line 26.
Name "main::pisa_start" used only once: possible typo at pisa.pl line 32.
Odd number of elements in hash assignment at pisa.pl line 15.
Odd number of elements in hash assignment at pisa.pl line 20.
Use of uninitialized value in concatenation (.) or string at pisa.pl line 26.
print() on closed filehandle INPUT at pisa.pl line 27.
Use of uninitialized value in system at pisa.pl line 32.
到底是怎么回事?