简体   繁体   English

Perl:Bareword在操作员期望的位置找到

[英]Perl : Bareword found where operator expected

#!/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;

}

In this code I am receiving an error : 在这段代码中,我收到一个错误:

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?)

Replace 更换

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

to

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

and try again. 然后再试一次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在操作员预期的位置找到了裸字 - bareword found where operator expected Perl搜索并替换文件错误“在期望操作员的地方找到了密码” - Perl search and replace in file error “Bareword found where operator expected” Perl语法错误:在操作员期望的位置找到了裸词 - Perl syntax error: Bareword found where operator expected Perl语法错误:在操作员期望的位置找到裸字 - Perl Syntax Error: bareword found where operator expected perl s/this/that/r ==&gt; “Bareword found where operator expected” - perl s/this/that/r ==> “Bareword found where operator expected” Bareword 在 Perl 脚本中的错误处找到操作员预期的位置 - Bareword found where operator expected at Error in Perl script 在操作员预期的语法错误所在的地方找到了裸字 - bareword found where operator expected syntax error 为什么我的Perl一线式报告“在操作员期望的位置发现裸字”? - Why does my Perl one-liner report “Bareword found where operator expected”? 找到在操作员期望的-e第1行“ 9A”附近的裸词 - Bareword found where operator expected at -e line 1, near “9A” Perl v5.10 中的 $AUTOLOAD 评估显示“在操作员预期的位置找到了 Bareword”...但是 v5.26 工作正常 - Perl $AUTOLOAD evaluation in v5.10 says "Bareword found where operator expected"...but v5.26 works fine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM