在下面给出的代码块上,当我在linux下运行它..。
my $source = 'BAD-IP-Addresses-LABEL';
my $type_description = 'honeypots-for-examnple';
open(FP, 'your-csv-file.csv')
for my $line (<FP>) {
my ($hostname, $ip, $something1, $something2) = split(/,/, $line);
print OUT "$source $type_description $ip #FF0000 0 90 29\n";
}
close(FP);它让我犯了一个错误
syntax error at ./seculert_rest_qradar.pl line 131, near "$line ("
syntax error at ./seculert_rest_qradar.pl line 135, near "}"
Execution of ./seculert_rest_qradar.pl aborted due to compilation errors.我正在使用chmod 755运行脚本,要完全了解脚本的功能,请转到那里。
请给我建议。
发布于 2013-12-20 14:45:55
您在OPEN语句之后缺少了一个分号:
my $source = 'BAD-IP-Addresses-LABEL';
my $type_description = 'honeypots-for-examnple';
open(FP, 'your-csv-file.csv') # <-- here
for my $line (<FP>) {
my ($hostname, $ip, $something1, $something2) = split(/,/, $line);
print OUT "$source $type_description $ip #FF0000 0 90 29\n";
}
close(FP);在进入for循环之前,您不会得到语法错误,因为这是完全有效的perl:
open(FP, 'your-csv-file.csv') for my $linehttps://stackoverflow.com/questions/20706112
复制相似问题