SpreadSHeet::WriteExcel Error

R

Rajpreet

Greetings,

I am trying to generate an excel report using perl. However, I am
getting below error. Below is the sample file and error quote. Can any
one suggest something?

Sample Code:
#!/tools/perl/bin/perl
use Spreadsheet::WriteExcel;

my $logFile;
$logFile ="/users/rajpreet/Perl_Test07012009.xls";
#unlink($logFile);
print ("logfile is $logFile \n");
$workbook = Spreadsheet::WriteExcel->new('$logFile');
print "At the end of file \n";

Error:
Can't open $logFile. It may be in use or protected at /auto/rajpreet/
test.pl line 8
logfile is /rajpreet/Perl_Test07012009.xls
At the end of file

TIA.
 
C

C.DeRykus

Greetings,

I am trying to generate an excel report using perl. However, I am
getting below error. Below is the sample file and error quote. Can any
one suggest something?

Sample Code:
#!/tools/perl/bin/perl
use Spreadsheet::WriteExcel;

# well-written programs always include lines below

use strict;
use warnings;

my $logFile;
$logFile ="/users/rajpreet/Perl_Test07012009.xls";
#unlink($logFile);
print ("logfile is $logFile \n");
$workbook
          = Spreadsheet::WriteExcel->new('$logFile');
^^^^^^^^^^^
^^^^^^^^^^^

perldoc perlintro for an explanation of what's
wrong with your quote selection above.
 
J

Justin C

Greetings,

I am trying to generate an excel report using perl. However, I am
getting below error. Below is the sample file and error quote. Can any
one suggest something?

use warnings;
use strict;

I fixed the error and the code worked for me.

Justin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top