in reply to <FILE> Questions
There's a lot of wierd stuff going on in here, I'm not sure I got this right, but let's try.
In your second example, you use $_content where I see a $content read from the db. then you perform your substitution on $_ where you should have done it -- I assume -- on $content, $content =~ s/{{([a-zA-Z0-9\{\'\}_]+)}}/ eval ($1) /ge;
OTOH, I think it's safer/better(?) to use a hash instead of evaluating strings. So instead of doing s/{{([a-zA-Z0-9\{\'\}_]+)}}/ eval ($1) /ge; you would do s/{{([a-zA-Z0-9\{\'\}_]+)}}/$hash{$1}/g; - but I don't know the context of this, so I can't judge.
does this actually run? what errors does it produce?
Update: I re-read your question, namely this part:
What if that is in a database, and instead of it having $string it has {{string}} and I normally do a s/{{string}}/$string/g;That would work if you do it like so:
unless you're using strict refs.s/{{([^}]+)}}/${$1}/g;
|
|---|