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.
In reply to Re: construct variable name on the fly
by bradcathey
in thread construct variable name on the fly
by aquarium
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |