use of uninitialized value $line in scalar chomp at 2.3.pl l
来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/11/01 07:24:05
use of uninitialized value $line in scalar chomp at 2.3.pl line 10,是哪里出了错?
use strict;
use warnings;
open IN_FILE,"
use strict;
use warnings;
open IN_FILE,"
"use of uninitialized value $line" 说你在第10行使用了未定义的值$line ;
09.$line = ; # while循环到最后一行后,没有退出,还要再读入
10.chomp($line); #读入的内容为空,即$line未定义
改成下面的方式:
while(1){
$line = ;
if(not defined($line)){
\x05last;
}
chomp($line);
print "$line ";
$a=$a+$line;
$number++;
}
所以先进行判断,$line是否有值,无则退出
尽管不知道你在考什么,但是大概明白了这是在求一个txt文件中一列数字的平均数
09.$line = ; # while循环到最后一行后,没有退出,还要再读入
10.chomp($line); #读入的内容为空,即$line未定义
改成下面的方式:
while(1){
$line = ;
if(not defined($line)){
\x05last;
}
chomp($line);
print "$line ";
$a=$a+$line;
$number++;
}
所以先进行判断,$line是否有值,无则退出
尽管不知道你在考什么,但是大概明白了这是在求一个txt文件中一列数字的平均数
perl提问 关于 Use of uninitialized value in string eq at line 48
Perl Use of uninitialized value in concatenation (.) or stri
xp问题value creation failed at line
The value of life lies not length of days,but in the use of
the value of life lies not length of days ,but in the use we
He cut in at the head of the line
out of memory at line
The present value of $100 due in 5 years at a 3% discount ra
out of line memory at line 56的解决方案!
Out of memory at line:416
out of memory at line 355 怎么办?
out of memory at line:512