in reply to construct variable name on the fly
Here's a method, but it doesn't work under strict.
{ no strict 'subs'; foreach $number(1..2) { print $var.$number . "\n"; } }
Update: Oops, a little too fast on the draw. I confused it with populating HTML::Template params. Way off!
{ no strict 'subs'; foreach $number(1..2) { $template ->param( var.$number => $somevalue ); } }
So, Fletch is absolutely correct on both accounts.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: construct variable name on the fly
by pg (Canon) on Oct 19, 2004 at 02:05 UTC | |
|
Re^2: construct variable name on the fly
by Fletch (Bishop) on Oct 19, 2004 at 00:45 UTC |