#!/usr/local/bin/perl
use strict;
use CGI::Carp qw(fatalsToBrowser);
# this is the required header
print "Content-type: text/html\n\n";
# this will go to the browser
print "
Show me 'Hello World!' the browser window!
"
my $file = "new_guestbook.html";
open(F,"+< $file") or die "Could not open $file: $!";
my @file = ;
s/date/localtime/eg for @file;
seek F,0,0 or die "Could not seek in $file: $!";
truncate F,0 or die "Could not truncate $file: $!";
print F @file; # this rewrites file
close F;
# this goes to browser, you see nothing if @file is empty
print @file