Try without the x modifier on the regex
poj#!/usr/bin/perl use strict; use CGI; use File::Slurp qw/read_file/; my $includepath = "c:/temp/"; my $file_to_read = 'aa.html'; my $html = read_file($file_to_read); $html =~ s{<!--#include file="([^"]+)"-->} {&add_template($includepath.$1)}gei ; print CGI::header(); print $html; sub add_template{ my $file = shift; if (-e $file){ return read_file($file); } else { warn "$file not found"; return '<!-- $file not found to include -->'; } }
In reply to Re^3: displaying html file in the browser using perl
by poj
in thread displaying html file in the browser using perl
by tsdesai
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |