Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Not able to create worksheets inside a subroutine

by roboticus (Chancellor)
on Sep 29, 2013 at 15:39 UTC ( [id://1056229]=note: print w/replies, xml ) Need Help??


in reply to Not able to create worksheets inside a subroutine

devbond:

A couple notes:

  • I don't see anything obviously wrong.
  • I've created workbooks similarly, so it's definitely not a problem in cpan::Spreadsheet::WriteExcel,
  • It's not a good practice to call functions using the ampersand. Just leave off the ampersand and it will be fine.
  • Your "C-style" loop could be more perlish, like:
    for $i (1 .. 8) { ... }

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: Not able to create worksheets inside a subroutine
by devbond (Novice) on Sep 29, 2013 at 15:53 UTC
    i made the following modifications but still no change in the output :(

    #!/usr/bin/perl

    use warnings; use Spreadsheet::WriteExcel; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; $Month=Sept; my @s; sub create { $workbook = Spreadsheet::WriteExcel->new('FAISTATS_'.'$Month'.'xls'); for $i(1..8) { $s[$i] = $workbook->add_worksheet( "rpzea0".$i."a001" ) ; } } create();

      Please add use strict; at the beginning and correct all errors that will be thrown. Also, the single quotes around $Month will prevent that you get the correct month. You also lack a dot in front of the extension xls.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-03-19 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found