in reply to Template Toolkit Embedded Perl

From the documentation:

[%a = 1%] [%b = ''%] [%PERL%] my $test = "[%a%]"; $test += 1; $stash->set('b', $test); [%END%]
update: added code.