$ perl -MTemplate -wE ' my $tt = Template->new; my $compiled = $tt->template(\"In-place [% foo %] query\n"); my $answer = 40; $tt->process( $compiled, {foo => $answer++} ) for 0..2; ' In-place 40 query In-place 41 query In-place 42 query #### my $tt = Template->new( INCLUDE_PATH => '/some/path', COMPILE_DIR => '/other/path', COMPILE_EXT => '.compiled', ); my $file = 'foo.tt'; my $data = { foo => 42 }; $tt->process( $file, $data ) or die $tt->error; # Template will be compiled and cached at '/other/path/foo.tt.compiled' # and that file will be used until '/some/path/foo.tt' changes