use Text::MicroMason; $interpreter = Text::MicroMason->new(); $template = "bar <% $ARGS{var1} %> foo <% $ARGS{var2} %> bar BAAAR!"; $subroutine = $interpreter->compile( $template ); $output = $subroutine->( var1=>"Guybrush", var2=>"Purcell" );