#!/usr/bin/perl use strict; use warnings; use Template; # Initialise the variable hash, and create us a TT2 obj. my $vars = { a => 0}; my $tt2 = Template->new(); # Very simple template, should increment TT2's 'a' variable. my $template = "[% SET a=a+1 %] A is now [% a %]\n"; # Loop through, see if we can keep the new value of a. for (1..5) { $tt2->process ( \$template, $vars ); }