#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
open (HTMLFILE, ">../htdocs/template2.html") || die ("open HTMLFILE failed");
print HTMLFILE "
Updated PageList of files
\n\n";
opendir(HOMEDIR, "../htdocs/archive") || die ("Unable to open directory");
@files = grep !/^\./, readdir(HOMEDIR);
closedir(HOMEDIR);
foreach $file (reverse sort @files) {
print HTMLFILE "$file
\n";
#the upper part of this code reads/prints the list of files and links them
#the next part of this code reads 5 lines of a file
open(STUFF, "../htdocs/archive/$file") || die ("Unable to open file");
while() {
1 .. 5 ? print HTMLFILE: last;
}
close (STUFF);
}
print HTMLFILE "";
close(HTMLFILE);
print "hopefully this works";