I am new to perl and having trouble with the spreadsheet excel parser module.
WHen I use $cell->value() on its own line, there appears to be no problem, however when I try to use this to insert the value into an array, it returns undef, code show below:
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;
}
}
}
Here print $cell->value; returns the contents of the cell but print Dumper $line; returns undef
You have to push $cell->value
not $value
push @line, $cell->value if defined($cell);
You should add use strict
at the beginning of your program, so you get an error message in such a case.