I'm attempting to learn the Template Toolkit and I'm having trouble even getting started. Can anyone see what I'm doing wrong?
#!/usr/bin/perl
use strict;
use Template;
my $template = new Template;
my $file = 'tt/template.html';
my $data = {
env => \%ENV,
};
print "Content-type: text/html\n\n";
$template->process($file, $data) || die $template->error;
the template file:
<html>
<head>
</head>
<body>
<ul>
[% foreach thing in env.keys.sort %]
<li><b>{% thing %}:</b>[% env.thing %]</li>
[% end %]
</ul>
</body>
</html>
the output:
# perl template.pl
Content-type: text/html
file error - parse error - tt/template.html line 12: unexpected token
+(thing)
[% foreach thing in env.keys.sort %]
I even tried a
[% get env %]
at the top of my template and that didn't seem to do any good either.
Thanks.
AM