in reply to Template strings

Mentioned above already, but thought I'd give an example of Template Toolkit to illustrate how similiar it is to your request:
use Template; my $template = Template->new(); my $my_template_string = 'bar [% var1 %] foo foo [% var2 %] bar bar BA +AAR!'; my $vars = {var1=>"Guybrush", var2=>"Purcell"}; my $string; $template->process(\$my_template_string, $vars, \$string);
Note that TT it is very powerful and supports all kinds (IF, FOREACH, BLOCK, etc) of logic. http://www.template-toolkit.org