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'); }
In reply to Re: variable in variables
by moritz
in thread variable in variables
by ohgary
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |