#!/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?)
答案 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];
再试一次。