before

after

#### #!/usr/bin/perl use CGI; #my $q = CGI->new; print CGI::header(); my $file_to_read = 'aa.html'; my $html =read_file($file_to_read); $html=~s/<\s*include\s+file\s*=\s*"([^"]+)"\s*>/&add_template($1)/gexi; print $html; sub add_template{ use File::Slurp qw/read_file/; return read_file($_[0]); } #### $html =~ s//&add_template($1)/gexi #### if(!-f $_[0]){ return "Could not include template '$_[0]' because: NO FILE" }elsif(!-r $_[0]){ return "Could not include template '$_[0]' because: NO ACCESS TO FILE"; }