in reply to How to simulate a preprocessor macro without one?

Does FIlter-Template approximate what you want? It's a Perl source filter that implements a simple form of code templates. Based on the SYNOPSIS:

use Filter::Template; template max (one,two) { ((one) > (two) ? (one) : (two)) } # Expand the "max" template inline. # Generates and runs code that prints # the largest value of two scalars. print {% max $a, $b %}, "\n";