in reply to HTML::TEMPLATE Simutaneous Templates
Hi
What do you mean by "write to templates"?
What do you mean by a "loop for a template"?
Some hints below
#!/usr/bin/perl -- use strict; use warnings; use HTML::Template; my $tmpl = q{ <TMPL_LOOP NAME=LOOP> Name: <TMPL_VAR NAME=NAME> Nicknames:<TMPL_LOOP NAME=nicknames> -: <TMPL_VAR NAME=NAME></TMPL_LOOP> </TMPL_LOOP>}; my $data = { LOOP => [ { name => 'Bobby', nicknames => [{name => 'the big bad wolf'}, {name => 'He-M +an'}], }, ], }; for(1..2){ my $template = HTML::Template->new( scalarref => \$tmpl, ); $template->param( %$data ); $template->output(print_to => *STDOUT); } __END__ Name: Bobby Nicknames: -: the big bad wolf -: He-Man Name: Bobby Nicknames: -: the big bad wolf -: He-Man
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: HTML::TEMPLATE Simutaneous Templates
by StrangeDucks (Initiate) on Aug 09, 2019 at 12:49 UTC | |
by hippo (Archbishop) on Aug 10, 2019 at 09:18 UTC | |
by Anonymous Monk on Aug 09, 2019 at 23:21 UTC |