in reply to variable in variables
The proper way to do this is to use a hash, not variable variable names:
use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new("demo.xls"); my %worksheets; my @PEOPLE = ("BOB" , "SUE", "JOHN" ); for my $p (@PEOPLE) { $worksheets{$p} = $workbook->add_worksheet($p); $worksheets{$p}->write('A2', ucfirst(lc($p)) . ' is here'); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: variable in variables
by ohgary (Initiate) on Apr 25, 2013 at 20:41 UTC | |
by eyepopslikeamosquito (Archbishop) on Apr 25, 2013 at 20:52 UTC |
In Section
Seekers of Perl Wisdom