I need to keep track of the number of times a user visits a website. I have the code done but I don't think I am counting the correct way as the dynamic web page keeps showing the same number of visits. Any tips would be so helpful!
#!/usr/bin/perl
use CGI qw(:standard -debug);
use CGI::Carp qw(fatalsToBrowser);
#prevent Perl from creating undeclared variables
use strict;
#declare variables
my ($count, $C_record);
#assign input to variable
$count = cookie('count');
$count++;
#create cookie
$C_record = cookie(-name => "count",
-value => "$count ",
-path => "/cgi-bin/chap11",
-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";