P
perl Newbie
Hi,
I am getting an error message Can't call method "value" on an
undefined value at ....
I have used a print stmt print "RowL: $rowL ", $worksheet->get_cell
($rowL,6)->value(), "\n";
just to check the values it is working perfectly. But the array @qids
values are not printed in op, I think it is something to do with above
error message. Could someone please explain me what is wrong with my
code.
__CODE__
use strict;
use warnings;
use Spreadsheet:arseExcel;
my $excelfilename="data.xls";
my $datasheet="data";
my $parser = Spreadsheet:arseExcel->new();
my $workbook = $parser->Parse($excelfilename);
my $worksheet = $workbook->Worksheet($datasheet);
my ( $row_min, $row_max ) = $worksheet->row_range();
my $row;
my $rowL;
my @qids;
for $row ($row_min .. $row_max) {
if ($worksheet->get_cell($row,3)->value() =~/single choice/i)
{
$rowL=$row+1;
until ($worksheet->get_cell($rowL,0)->value()=~/
question/) {
if ($worksheet->get_cell($rowL,0)->value()=~/
column/) {
print "RowL: $rowL ", $worksheet-
($rowL,6)->value();
}
$rowL++;
}
}
}
foreach my $l (@qids) {
print $l, "\n";
}
I am getting an error message Can't call method "value" on an
undefined value at ....
I have used a print stmt print "RowL: $rowL ", $worksheet->get_cell
($rowL,6)->value(), "\n";
just to check the values it is working perfectly. But the array @qids
values are not printed in op, I think it is something to do with above
error message. Could someone please explain me what is wrong with my
code.
__CODE__
use strict;
use warnings;
use Spreadsheet:arseExcel;
my $excelfilename="data.xls";
my $datasheet="data";
my $parser = Spreadsheet:arseExcel->new();
my $workbook = $parser->Parse($excelfilename);
my $worksheet = $workbook->Worksheet($datasheet);
my ( $row_min, $row_max ) = $worksheet->row_range();
my $row;
my $rowL;
my @qids;
for $row ($row_min .. $row_max) {
if ($worksheet->get_cell($row,3)->value() =~/single choice/i)
{
$rowL=$row+1;
until ($worksheet->get_cell($rowL,0)->value()=~/
question/) {
if ($worksheet->get_cell($rowL,0)->value()=~/
column/) {
print "RowL: $rowL ", $worksheet-
push @qids, $worksheet->get_cellget_cell($rowL,6)->value(), "\n";
($rowL,6)->value();
}
$rowL++;
}
}
}
foreach my $l (@qids) {
print $l, "\n";
}