因为我用了个循环读一个excel,会读到空白单元格,遇到了空白单元格就报错。

发自我的 iPhone

在 2013-3-7,1:22,Hao Wu <[email protected]> 写道:

> 空白单元格你还读它干嘛? :)
> 
> 试试这个?
> 
> $value = defined $cell ? $cell->Value : undef;
> 
> 你也可以看看文档,看看有没有更好的方法。
> 
> 
> 
> 2013/3/6 baocheng li <[email protected]>
>> use Spreadsheet:ParseExcel;
>> my $Excel = new Spreadsheet:ParseExcel;
>> my $Book = $Excel->parse ("templete.xls");
>> my $Worksheet = $Book->{Worksheet}[0];
>> my $Name = $Worksheet->{Cells}[3][2]->Value;
>> 如果这个单元格是空的话,就报错“Can't call method "Value" on an underfined value at 
>> C:\Perl\excel.pl line36",这是怎么回事啊,难道无法读取空白单元格?
>> -- 
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
>> 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
> 
> -- 
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
> 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
>  
>  

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。


回复