#!/usr/local/bin/perl -w
BEGIN {
open (STDERR, ">/var/www/cgi-bin/games/error.txt");
}


#open head template and read into headlines
open(HEAD,"<head.temp")or die "Can't open head.temp: $!";
@headlines=<HEAD>;
close(HEAD);
#print out the head
foreach (@headlines) {
	print "$_";
}

$dir=".";
print "<ul>\n";
opendir (BIN, $dir) or die "Can't open $dir:$!";
while (defined ($file = readdir BIN) ) 
{
	print "<li><a href=$file>$file</a>\n" if (($file =~ m/\.html?$/i) && (-T "$dir/$file"));
}
print "</ul>\n";
closedir(BIN);

#open tail template and read into taillines
open(TAIL,"<tail.temp")or die "Can't open tail.temp: $!";
@taillines=<TAIL>;
close(TAIL);
#print out the tail
foreach (@taillines) {
	print "$_";
}


