use Text::MicroMason::Functions qw( execute ); $template = "bar <% $ARGS{var1} %> foo <% $ARGS{var2} %> bar BAAAR!"; $output = execute( $template, var1=>"Guybrush", var2=>"Purcell" );