in reply to including subroutines

Ciao Anonymous Monk,

if your goal is to have some sort of SSI, take a look at CGI::SSI or CGI::SSI_Parser. You can borrow some ideas there...

If you are working or planning to work under mod_perl, Apache::SSI could be the right answer. Personally I enjoyed very much rolling my own solution using HTML::TokeParser: the solution was to search for special tags and substitute them with the output of a subroutine.
The Eagle Book has a great example of building your own SSI solution with custom libraries of functions.

Another solution can be HTML::Template::Expr; please refer to its man page for details. BTW, I think that using HTML::Template can help you separating presentation (html) from code.

Ciao, Valerio