Reputation: 21
I'm trying to create an excel file using perl scripting.
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.
Upvotes: 0
Views: 956
Reputation: 3705
You need to declare the $worksheet
variable, like this
my $worksheet = $workbook->add_worksheet('cc'); # Step 2
Upvotes: 5