in reply to Re^8: displaying html file in the browser using perl
in thread displaying html file in the browser using perl

much Ho,Ho,Ho!

When i first saw this i was concerned but didnt say anything

$html =~ s{#include file="([^"]+)"}{&add_template($1)}gei
now remember that the htmlish command is
<!--#include file="somefolder/cc.html" -->
and think of what is to be replaced-from in that statement .... and then think about what is left behind. Your included text is now between <!-- -->, ie html comments!

now im not great at REs, but let me suggest

$html =~ s{\<\!\-\-#include file="([^"]+)".*?\-\-\>}{&add_template($1) +}gei
( i escape things a lot 'cuz im never sure ....)

edit:added ? to ".*?\-\-\>, its not good to be greedy here