# # Replace ### with environmental variable variable 'page' # sub filter { my ($text_ref ) = shift; my $val = $ENV{'page'}; $$text_ref =~ s/###/$val/g; }; # # Load 'layout.tmpl' - and have that include 'page.inc'. # # THis will expand the following in *both* files! # # # # $ENV{'page'} = 'page.inc'; my $template = HTML::Template->new(filename => 'layout.tmpl', filter => \&filter ); $template->param( title => "Something here" ); print $template->output();