use Text::Template 'fill_in_file'; my $TEMPLATE= 'my.templ'; # ... my $filled_template= fill_in_file( $TEMPLATE); # I usually use the HASH option to separate variables that # go in the template from variables in the code # my $filled_template= fill_in_file( $TEMPLATE, # HASH => { title => $title, # fields => \%fields # } # ); print $filled_template; #### My Kewl Page

{$title}

Field1: {$field{field1}}

{ "

Field2: $field{field2}

" if( $field{field2} }