in reply to Not able to create worksheets inside a subroutine
One typo in your code might cause the problem:
should be$workbook = Spreadsheet::WriteExcel>new('FAISTATS_'."$Month".'.xls');
$workbook = Spreadsheet::WriteExcel->new('FAISTATS_'."$Month".'.xls');
When I corrected this and ran it under use strict; (a few declarations are needed...), it created a file with the desired sheets.
use warnings; use strict; use Spreadsheet::WriteExcel; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; my $Month = 9; my @s; sub create_excel { my $workbook = Spreadsheet::WriteExcel->new('FAISTATS_'."$Month".'.x +ls'); for ( my$i=1;$i<=8;$i++) { $s[$i] = $workbook->add_worksheet( "rpzea0".$i."a001" ) ; } } create_excel();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Not able to create worksheets inside a subroutine
by devbond (Novice) on Sep 29, 2013 at 16:00 UTC | |
by hdb (Monsignor) on Sep 29, 2013 at 16:04 UTC | |
by devbond (Novice) on Sep 29, 2013 at 16:53 UTC | |
by hdb (Monsignor) on Sep 29, 2013 at 17:42 UTC | |
by devbond (Novice) on Sep 29, 2013 at 18:02 UTC | |
| |
by ig (Vicar) on Sep 30, 2013 at 07:15 UTC |