You could do the backtick way (as davorg mentioned), but if you are using mod_perl, you may want to look at Apache::SSI. This may (or may not) do what you want with minimal changes. But, if you are changing the whole way your system works (static to dynamic) you may want to not put a bandaid on it and simply redo it all the right way. What is the right way? Well, that is for you to decide. Maybe HTML::Mason is, or Embperl, etc...
Cheers,
KM