I am new to using Template and don't quite understand
variable notation. Suppose I have the following program:
#!perl
use Template;
my $tt = Template->new();
my $data ="">{
d1 => [ 1, 3 ],
d2 => { 0 => "zero", 1 => "one", 2 => "two", 3 => "three" }
};
my $data ="">{
d1 => [ 1, 3 ],
d2 => { 0 => "zero", 1 => "one", 2 => "two", 3 => "three" }
};
$tt->process("foo.tt", $data);
and the following data file (foo.tt):
[% FOREACH id = d1 %]
id is [% id %]
[% d2.id %]
[% END %]
id is [% id %]
[% d2.id %]
[% END %]
The output of id works as expected. But I am trying
to use id as a key into d2 and I am not getting
it. Obviously I am misunderstanding this. How are
you supposed to do this sort of thing?
Dean
Start your day with Yahoo! - make it your home page
