[英]Perl Excel::Writer::XLSX
I'm trying to create an excel file using perl scripting.我正在尝试使用 perl 脚本创建一个 excel 文件。
I followed the tutorial and write the following code :我按照教程编写了以下代码:
#!/usr/bin/perl
use strict;
use warnings;
use Excel::Writer::XLSX;
use Excel::Writer::XLSX::Utility;
my $workbook = Excel::Writer::XLSX->new( 'perl.xlsx' ); # Step 1
$worksheet = $workbook->add_worksheet('cc'); # Step 2
$worksheet->write( 'A1', 'Hi Excel!' );
But I got the following error :但我收到以下错误:
Global symbol "$worksheet" requires explicit package name at test_excel.pl line 10.
Global symbol "$worksheet" requires explicit package name at test_excel.pl line 11.
您需要像这样声明$worksheet
变量
my $worksheet = $workbook->add_worksheet('cc'); # Step 2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.