I'm no HTML::Template expert, but your code is weird. Here is an example adapted from
http://search.cpan.org/~tinita/HTML-Template-Compiled-0.92_001/lib/HTML/Template/Compiled/Reference.pod#LOOP,_WHILE,_EACH
http://search.cpan.org/src/TINITA/HTML-Template-Compiled-0.92_001/t/21_while.t
#!/usr/bin/perl -- use strict; use warnings; use HTML::Template::Compiled; { my $htc = HTML::Template::Compiled->new( scalarref => \'<%each foo%>key <%= __key__ %>=<%= __value__ %> <%/each%>', debug => 0, loop_context_vars => 1, ); $htc->param(foo => { a => 1, b => 2, c => 3 }); my $out = $htc->output; print $out,$/; } { my $htc = HTML::Template::Compiled->new( scalarref => \'<TMPL_EACH foo>key <TMPL_VAR __key__ >=<TMPL_VA +R __value__> </TMPL_EACH>', debug => 0, loop_context_vars => 1, ); $htc->param(foo => { a => 1, b => 2, c => 3 }); my $out = $htc->output; print $out,$/; } __END__ key c=3 key a=1 key b=2 key c=3 key a=1 key b=2

In reply to Re: HTML::Template::Compiled - TMPL_EACH by Anonymous Monk
in thread HTML::Template::Compiled - TMPL_EACH by mmanso

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.