$inp =~ s/<%([^=].*?)%>/eval $1/ges #this is one $inp =~ s/<%=(.*?)%>/eval $1/ges #this is the second #### <% my $test=''; if (@{$ctxt{'params'}}) { $test= 'index=1011' 'asln=' . join(' ',@{$ctxt{'params'}})."\n". } $test; %> #### <% $ctxt{'common_params'}; %>