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