Gossamer Forum
Home : General : Perl Programming :

why won't this work?

Quote Reply
why won't this work?
this is a counter script i am working on, but i can't get it to work. if the script isn't the problem, what else could be? i renamed the page .shtml, and included the ssi call in the page.

#!/usr/bin/perl

open(COUNT, "count.dat");
$count = <COUNT>;
close (COUNT);
open(COUNT, "> count.dat");
$count += 1;
print COUNT "$count";
close (COUNT);

print "$count";
Quote Reply
Re: why won't this work? In reply to
Try replacing:
Code:
$count += 1;
with
Code:
$count++ ;
-Matt
Quote Reply
Re: why won't this work? In reply to
Also try checking return calls for open(), and you should really consider file locking if this is a web counter.

Cheers,

Alex
Quote Reply
Re: why won't this work? In reply to
i'm new to perl so how do i check return calls for open()? and how do i lock the file? also does it matter that it's extension is .cgi not .pl? i've tried everything, but it just doesn't work. i use FTP Explorer to upload my files, and i upload the counter script and the text file that keeps count in ascii mode compared to binary mode. what's the problem? is someone willing to try to get it to work themselves? Thnaks.