in reply to MyInclude

Using read() to slurp up an entire file is kinda silly. read() is more useful when reading in a very large file in small chunks. Since you are reading in the entire file, storing the contents into RAM, you might as well just slurp the file into a scalar. If this is all that your code is doing ... converting the contents of a file to an array then shouldn't it be named file2array or similar? Also, die()ing in the middle of a subroutine like that is not nice to the client who uses your code.

Here is slightly different version that returns a scalar instead of an array.

sub file2scalar { my $filename = shift; return "Error: $filename doesn't exist" unless -f $filename; open FH, $filename || return "Error: can't read $filename"; return do{local $/; <FH>}; }
When you call this sub:
my $include = file2scalar('foo.html');
$include will either contain the contents of the file or an error message. Instead of differentiating between the two, i recommend just printing $include to the browers, much like PHP does when you give it's include() function a file that doesn't exist or can't be read. (of course, my real recommendation is to just go ahead and install CGI::SSI instead)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)