ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-users
perl-win32-users
Re: Spreadsheet-WriteExcel
by $Bill Luebkert other posts by this author
Jan 30 2004 5:31PM messages near this date
view in the new Beta List Site
Spreadsheet-WriteExcel | RE: Determing if a file has changed
Miguel Demaerel wrote:

>  Hoi perl gurus
>  
>  I have a question I can't solve.
>  I won't to assign a variable to a sheet name.
>  For example; if I choose 1 it write to sheet Jan, if I choose  2 it will write to sheet Fe
b ...
>  
>  But I can't assign the $sheet=Jan.
>  I get thet error...
>  
>  
>  use Spreadsheet::WriteExcel;
>  use strict;
>  
>  
>  # Create Excel workbook and sheets
>  my $workbook = Spreadsheet::WriteExcel->new("perl.xls");
>  my $Jan = $workbook->addworksheet("January");
>  my $Feb = $workbook->addworksheet("February");
>  my $Mar = $workbook->addworksheet("March");...

Maybe try storing the objects in a hash:

my %sheets;
$sheets{Jan} = $workbook-> addworksheet("January");

>  ....
>  
>  # Asking the period.
>  print "Give the period: "; my $PERIOD = <STDIN>; chomp $PERIOD;
>  if ( $PERIOD=~ /1/ )
>  {
>      my $sheet = 'Jan';

Then this becomes :

   my $sheet = $sheets{Jan};

>  }
>  
>  ....
>  
>  $$sheet->write(0,1,"NA_NAME"); #I wont to write to sheet Jan, but I can't assign $sheet to
 the object sheet.
>  
>  ...
>  
>  # close the connections
>  $workbook->close();


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:dbecoll@[...].net
 (_/   /  )    // //       DBE Collectibles    Mailto:dbe@[...].com
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Miguel Demaerel
$Bill Luebkert

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved