#!/perl/bin/perl use strict; use warnings; use Template; my $template = Template->new(); my $str = "some [% foo.bar %] stuff\n"; $template->process(\$str, { foo => { bar => 'cool' }, }) or warn $template->error; __END__ some cool stuff