open(DATA,"hello.template"); my @template=; close(DATA); print "Content-type: text/html\n\n"; for my $line (@template) { # you should probably use an HTML parsing module # here instead of a regex if ($line =~ m//) { my $include = $1; do $include; } else { print $line; } }