Two very popular and common templating modules are Template Toolkit and HTML::Template -- i would start by looking at both of those.. Template Toolkit (tt) is quite powerful, and has a (default) syntax like:
This is my file.
Hello, [% first_name %]. You have [% rows.size %] items:
[% FOREACH row = rows %]
Name: [% row.name %] ; Color = [% row.color %] [% 'Wow!!!' IF ro
+w.color == 'red' %]
[% END %]