Perl: Process an array or a hash inside a Template

On March 17, 2012, in PERL, by Dipin Krishna

Process and array or a hash inside a perl template

#Print an Array named items
[% FOREACH item IN items -%]
   [% item %]
[% END -%]
 
#Print a HASH named items
[% FOREACH key IN items.keys.sort -%]
   [% key %]: [% terms.$key %]
[% END -%]

Enjoy coding! 🙂

 

Leave a Reply

*

Search