Handling array reference
Rajesh Saha <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Message-ID | <CADoJNqD8xRHhZHjDdpXOe4rc6JB63i0CJVmMOFLLOdwmR5uBBg@mail.gmail.com> |
Hi
*I have a perl script like this:*
#!/usr/bin/perl
use Template ;
$tt = Template->new();
$file = "test.tt" ;
%hash = (
'a' => [1,2],
'b' => [3,4],
) ;
$vars = {
hash => \%hash
} ;
$tt->process($file,$vars) ;
*The template file (test.tt) is like this :*
[% FOREACH key IN hash.keys %]
[% key %] [% ":" %][% key.0 %][% key.1 %]
[% END %]
*My intension is to get an output like this :*
a : 1 2
b : 3 4
But, I not getting. Actually, I don't know how to handle the reference in
template . Can anybody please help ?
Thanks n regards
Rajesh Saha
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates