ticker.html#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use HTML::Template; my $param = { ticks => [ { tick => 'tick1', subject => '8-15-2006', names => [ { name => 'jerry', }, { name => 'john', }, { name => 'jen', }, ], }, { tick => 'tick2', subject => '8-16-2006', names => [ { name => 'Keith' }, { name => 'Ken', }, { name => 'Kendra', }, ], }, ], }; #print Dumper $param; my $t = HTML::Template->new(filename => 'ticker.html'); $t->param($param); print $t->output;
output (some black lines removed)<html> <head> <title>ticker</html> </head> <body> <TMPL_LOOP NAME = 'ticks'> <div id = "<TMPL_VAR NAME = 'tick'>" class = "dropcontent" subject = "<TMPL_VAR NAME = 'subject'>" > <TMPL_LOOP NAME = "names"> <TMPL_VAR NAME = "name"> </TMPL_LOOP> </div> </TMPL_LOOP> </body> </html>
---------- Capture Output ---------- > "C:\Perl\bin\perl.exe" _new.pl <html> <head> <title>ticker</html> </head> <body> <div id = "tick1" class = "dropcontent" subject = "8-15-2006" > jerry john jen </div> <div id = "tick2" class = "dropcontent" subject = "8-16-2006" > Keith Ken Kendra </div> </body> </html> > Terminated with exit code 0.
In reply to Re: Filtering out a hash to display proper HTML
by wfsp
in thread Filtering out a hash to display proper HTML
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |