开发者

Global symbol requires package name error in perl script

Error:"Global symbol "$ipn开发者_如何学JAVA" requires explicit package name at perl.pl line 66. Global symbol "$sizen" requires explicit package name at perl.pl line 76. Execution of perl.pl aborted due to compilation errors."

$iaddr = inet_aton("$ip") or die "Cannot resolve hostname $ipn";
$endtime = time() + ($time ? $time : 1000000);
socket(flood, PF_INET, SOCK_DGRAM, 17);

print "Flooding $ip " . ($port ? $port : "random") . " port with " . 
($size ? "$size-byte" : "random size") . " packets" . ($time ? " for $time seconds" : "") . "n";
print "Interpacket delay $delay msecn" if $delay;
print "total IP bandwidth $bw kbpsn" if $bw;
print "Break with Ctrl-Cn" unless $time;

die "Invalid packet size requested: $sizen" if $size && ($size < 64 || $size > 1500);


You have strict turned on (which is always a good idea). It's complaining about these calls:

die "Cannot resolve hostname $ipn";
die "Invalid packet size requested: $sizen" 

because you haven't declared variables named $ipn or $sizen. Did you mean:

die "Cannot resolve hostname $ip\n";
die "Invalid packet size requested: $size\n"

If so, then strict was doing its job, and catching your mistake. You have some other strings that end in ...n" that probably should have been ...\n", but since those aren't variable references, strict can't tell there's a problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜