my $template = Template->new(); my $vars = {co_name=>"Foo-Co"}; my $my_template_string = 'I work for [% co_name %], the best company there is!'; my $string; $template->process(\$my_template_string, $vars, \$string); # stores output in $string print $string; $template->process(\$my_template_string, $vars ); # dumps output to STDOUT #### $content =~ s/(\$[a-zA-Z0-9\{\'\}_]+)/ eval($vars{$1}) || $vars{eval($1)} || eval($1) /ge; #### $content =~ s/(\$[a-zA-Z0-9\{\'\}_]+)/ eval($temp_vars{$1}) /ge; $content =~ s/(\$[a-zA-Z0-9\{\'\}_]+)/ $temp_vars{eval($1)} /ge;