use Text::Template; sub Tmpl { my($file) = @_; my($fh) = "FILE_HANDLE_00"; my($tmpl,$text); ++$fh; if(!-f $file) { if(-f "templates/$file") { $file = "templates/$file"; } } open($fh,"$file") || die "Could not open $file\n"; $tmpl = new Text::Template( 'type' => 'FILEHANDLE', 'source' => $fh ); $text = $tmpl->fill_in( 'package' => main ); close($fh); return $text; } 1;