The script doesn't appear to read the cookie. In your error log (or whatever file STDERR writes to) you may find something like "Use of uninitialized value $count in concatenation (.) or string at..."
d5e5
Practically a Posting Shark
810 posts since Sep 2009
Reputation Points: 159
Solved Threads: 159
Sorry for the confusion. The error message I posted was caused by a print statement I inserted to print the value of $count before incrementing it. The following modified version of your script seems to work for me now. I'm not sure why.
#!/usr/bin/perl
#countvisits.cgi
use strict;
use warnings;
use CGI qw(:standard -debug);
use CGI::Carp qw(fatalsToBrowser);
#declare variables
my ($count, $C_record);
#Create a new CGI object
my $cgi = new CGI;
#Read the cookie
#assign input to variable
$count=$cgi->cookie('count');
$count++;
#create cookie
$C_record = cookie(-name => "count",
-value => $count,
-expires => "6M");
#send cookie to browser
print header(-cookie => $C_record);
#create Web page
print "<HTML>\n";
print "<HEAD><TITLE>Jubilee Book Club</TITLE></HEAD>\n";
print "<BODY>\n";
print "<H1 ALIGN=center>Hello!<BR>\n";
print "You have been here $count times.</H1>\n";
print "</BODY></HTML>\n";
d5e5
Practically a Posting Shark
810 posts since Sep 2009
Reputation Points: 159
Solved Threads: 159