|
|
| No such thing as a small change | |
| PerlMonks |
Re: Regex to replace $vars with subroutineby friedo (Prior) |
| on Jun 06, 2008 at 19:53 UTC ( #690746=note: print w/ replies, xml ) | Need Help?? |
|
The proper way to do this is with one of the many templating modules that exist on CPAN, such as HTML::Template. But if you truly want to roll your own, you can use the /e option on your regex (see perlre) to make the replacement string executable code.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||