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! 🙂

Dipin Krishna

Written by Dipin Krishna

Senior full-stack engineer — 15 years across Django, Laravel, SwiftUI and the infrastructure underneath. Available for contract work.

Work with me →

Leave a note

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.