Briefly,
I am using regular expressions to first get a block of code from a string, then I want to use an eval to evaluate and then replace what evaluate would return in the $@ variable
example
text
<# { if (a == b) { print "a=b"; } } #> and more stuff
<# { print 4*3; } #> and more stuff and so on....
and i want to replace the code blocks with what the evaluate would get from them
so far i have
$data =~ s/<# (\{.*?\}) #>/eval($1)/eg;
which will evaluate the code, but only replace a 1 where things should go, because i can't get a $@ in there.
Incidentally, it will prematurely write headers when i do it this way to a webpage.
is it possible to do this... to make it harder, there are multiple instances of the blocks of code. i think this is pretty much what HTML Mason does, but i am no perl god.
----
FightLiteracy
http://www.fightliteracy.com