Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Issue with Spreadsheet::WriteExcel

by Crackers2 (Vicar)
on Aug 24, 2010 at 17:29 UTC ( #856988=note: print w/ replies, xml ) Need Help??


in reply to Re: Issue with Spreadsheet::WriteExcel
in thread Issue with Spreadsheet::WriteExcel

I think the message means $worksheet is undefined, not one of the parameters.

And I think the real problem is because of all the extra my's in there.

my $workbook; # No need for the = () my $worksheet; # No need for the = () # Create output file with user filename: if ($outfile ne "d") { $workbook = Spreadsheet::WriteExcel->new($outfile); # No my, or $wo +rkbook will go out of scope at the end of the if block $worksheet = $workbook->add_worksheet(); # same here print "What should we label the column containing the data?\n"; my $colname = <STDIN>; chomp($colname); $worksheet->write(0,"A",$colname); } # Other code here I assume # Write 00 temperature data into file: $read = 4+(($day-1)*58); $temp = $xls->1{("B", $read)}; $row = $day + 1; $worksheet->write($row,$col,$temp); # No my $day = $day + 1;

Now $worksheet won't go out of scope after the if block, and the later code can still use it.


Comment on Re^2: Issue with Spreadsheet::WriteExcel
Select or Download Code
Re^3: Issue with Spreadsheet::WriteExcel
by mprogan365 (Initiate) on Aug 24, 2010 at 17:52 UTC
    Problem solved! thanks a lot folks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://856988]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2014-07-11 03:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (218 votes), past polls