Skip to content

Perl: Process an array or a hash inside a Template

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

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.