CGI Perl



Please add to my guest book...





Please enter your name: 






Please enter your comments: 












#File: guestbook.cgi
#!/usr/bin/perl
use CGI;                             
$co = new CGI;                        
open (BOOK, "+seek (BOOK, -length($co->end_html), 2);
$date = `date`;
chop($date); 
$username = $co->param('username');
$username =~ s/$text = $co->param('comments');
$text =~ s/print BOOK 
$co->h3
(
    "New comments by ", $username, " on ", $date,
    $co->p,
    $text,
),
$co->hr,
$co->end_html;
close BOOK;
print $co->header,                    
$co->start_html
(
    -title=>'Guest Book Example', 
    -author=>'your name', 
    -BGCOLOR=>'white', 
    -LINK=>'red'
);
print
$co->center
(
    $co->h1('Thanks for adding to the guest book!')
),
"If you want to take a look at the guest book, ", 
$co->a
(
    {href=>"http://www.yourserver.com/user/cgi/book.htm"},
    "click here"
), 
".",
$co->hr,
$co->end_html;