Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This worksheet doesn't get added unless I use it outside of the subroutine like so:use warnings; use strict; use Spreadsheet::WriteExcel; # Create a new Excel workbook my $workbook = Spreadsheet::WriteExcel->new("perl.xls"); my $worksheet; add_ws(); sub add_ws { $worksheet = $workbook->add_worksheet('Test'); }
Any idea why or am I totally missing something?use warnings; use strict; use Spreadsheet::WriteExcel; # Create a new Excel workbook my $workbook = Spreadsheet::WriteExcel->new("perl.xls"); my $worksheet = $workbook->add_worksheet('Test');
Thanks
2007-01-06 Retitled by planetscape, as per Monastery guidelines
Original title: 'subroutine mystery?'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help adding a worksheet in a subroutine with Spreadsheet::WriteExcel
by kyle (Abbot) on Jan 05, 2007 at 18:50 UTC | |
|
Re: Help adding a worksheet in a subroutine with Spreadsheet::WriteExcel
by ferreira (Chaplain) on Jan 05, 2007 at 18:54 UTC | |
|
Re: Help adding a worksheet in a subroutine with Spreadsheet::WriteExcel
by ww (Archbishop) on Jan 05, 2007 at 18:26 UTC | |
by Anonymous Monk on Jan 05, 2007 at 18:30 UTC | |
by Anonymous Monk on Nov 17, 2015 at 20:17 UTC |