#!/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 => \'key = ', 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