S
sam
Hi,
I try to use Spreadsheet::WriteExcel in my perl project, but couldn't
get the ref of $worksheet passed into a subroutine. Please see the code
below:
#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
sub testing_sub
{
my ($myvar1,$myvar2,$worksheet,$excel_file) = @_;
$worksheet->write(0, 1, "testing") if ($worksheet and $excel_file);
print $myvar1, $myvar2;
}
sub main
{
# Create a new workbook called simple.xls and add a worksheet
my $workbook = Spreadsheet::WriteExcel->new("simple.xls");
my $worksheet = $workbook->add_worksheet();
my$excel_file = "./simple.xls";
$worksheet->write(0, 0, "Hi Excel!");
testing_sub("str1","str2",\$worksheet,$excel_file);
# testing_sub("str1","str2",\$worksheet);
}
main();
What should be the correct way to pass the ref obj of $worksheet?
thanks
Sam
I try to use Spreadsheet::WriteExcel in my perl project, but couldn't
get the ref of $worksheet passed into a subroutine. Please see the code
below:
#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
sub testing_sub
{
my ($myvar1,$myvar2,$worksheet,$excel_file) = @_;
$worksheet->write(0, 1, "testing") if ($worksheet and $excel_file);
print $myvar1, $myvar2;
}
sub main
{
# Create a new workbook called simple.xls and add a worksheet
my $workbook = Spreadsheet::WriteExcel->new("simple.xls");
my $worksheet = $workbook->add_worksheet();
my$excel_file = "./simple.xls";
$worksheet->write(0, 0, "Hi Excel!");
testing_sub("str1","str2",\$worksheet,$excel_file);
# testing_sub("str1","str2",\$worksheet);
}
main();
What should be the correct way to pass the ref obj of $worksheet?
thanks
Sam