agianni has asked for the wisdom of the Perl Monks concerning the following question:
Is there an easy way to do dynamic variable naming in Template Toolkit a la:
${ eval $var_name } = 'foo';
I know I can do this by using a [% PERL %] block, but I'd rather not. I also noticed that there is an eval filter built into TT, but that appears to be for eval-ing TT code.
And, lest anyone suggest that this is what hashes are for :) I'm well aware of that fact, but I need to get this working to provide a hook into some legacy template code.
perl -e 'split//,q{john hurl, pest caretaker}and(map{print @_[$_]}(joi +n(q{},map{sprintf(qq{%010u},$_)}(2**2*307*4993,5*101*641*5261,7*59*79 +*36997,13*17*71*45131,3**2*67*89*167*181))=~/\d{2}/g));'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dynamic variable naming in Template Toolkit
by perrin (Chancellor) on May 30, 2007 at 20:14 UTC | |
by agianni (Hermit) on May 31, 2007 at 15:10 UTC | |
by perrin (Chancellor) on May 31, 2007 at 15:37 UTC | |
by agianni (Hermit) on May 31, 2007 at 16:03 UTC | |
|
Re: Dynamic variable naming in Template Toolkit
by Trizor (Pilgrim) on May 30, 2007 at 19:32 UTC | |
by agianni (Hermit) on May 30, 2007 at 20:25 UTC |