我对perl很陌生,电子表格excel解析器模块也有问题。
WHen我在自己的行上使用$cell-> value (),似乎没有问题,但是当我尝试使用它将值插入数组时,它返回undef,代码如下所示:
for my $row ($row_min .. $row_max) {
my @line;
for my $col ( $col_min .. $col_max) {
my $cell = $worksheet->get_cell( $row, $col );
$value = $cell->value;
push @line, $value if defined($cell);
print $cell->value;
print Dumper $line;
}
}
}此处打印$ cell ->value;返回单元格的内容,但打印Dumper $line;返回undef
发布于 2015-06-03 10:44:44
你必须推动$cell->value而不是$value
push @line, $cell->value if defined($cell);您应该在程序开始时添加use strict,因此在这种情况下会得到错误消息。
https://stackoverflow.com/questions/30617793
复制相似问题