Thread: counter program
Results 1 to 2 of 2
12-09-2007, 12:42 PM #1
hi i am trying to create a perl script which tells us the number of times the pagre was acesses.
but it doesnt work properly
here is the perl script . please tell me what's wrong with it .................
#!/usr/bin/perl -w print "content-type: text/html\n\n"; print "<html><body>"; my $cnt_file = "count.txt"; my $num_access; open (FILE, "< $cnt_file"); $num_access = <FILE>; close(FILE); open (FILE, "> $cnt_file"); $num_access++; print FILE $num_access; close (FILE); print "<H1>Page Visited $num_access times</H1>"; print "</body></html>";
i even enable the write permission for the txt file.
but still it looks like the script never ends up updating the value of num_access in the file.
12-14-2007, 01:16 PM #2
Re: counter program
you need to make sure that count.text is already created and premissions are set to 755.