Perl:Bareword发现了运营商的预期

时间:2014-04-02 08:55:51

标签: perl

#!/usr/bin/perl
use strict;
use warnings;

open(my $fh, '<', 'eg')
or die("Can't open fileC: $!\n");

while (<$fh>) {


perl -ne '($host, $port, @ip) = split /[=;.]/; print if $port != 50000+200*$i[2]+$ip[3]' eg;

}

在此代码中,我收到错误:

Bareword found where operator expected at qeg.pl line 15, near "'($host, $port, @ip) = split /[=;.]/; print if $port != 50000+200*$i[2]+$ip[3]' eg"
    (Missing operator before eg?)

1 个答案:

答案 0 :(得分:0)

替换

perl -ne '($host, $port, @ip) = split /[=;.]/; print if $port != 50000+200*$i[2]+$ip[3]' eg;

my ($host, $port, @ip) = split /[=;.]/;
print if $port != 50000+200*$ip[2]+$ip[3];

再试一次。