in reply to Evaluate in a substitute

If the eval succeeds, that is, no compilation errors, and no fatal errors or dies, $@ will be *empty*. Furthermore, what you print in an eval, you can't capture easily. By default, it'll go to stdout. What you probably want is something like:
#!/usr/bin/perl use strict; use warnings; while (<DATA>) { s/<# \{(.*?)\} #>/$1/eeg; print; } __DATA__ <# { $a = 3; $b = 3; if ($a == $b) { "a=b"; } } #> <# { 4*3; } #>
Which prints:
a=b 12

Note the differences:

Abigail