text <# { if (a == b) { print "a=b"; } } #> and more stuff <# { print 4*3; } #> and more stuff and so on.... #### $data =~ s/<# (\{.*?\}) #>/eval($1)/eg;