Hi,
i just wrote a very small perl-file, which opens a file, reads the content,
adds a 1 and closes it. It's a
veeeeeeeeeery simple hitcounter. (counter.pl, code see below)
I would like now to print this in an existing html-sheet, say, when opening
index.html, this program should be
executed and the content of my counter-file (counter.cnt) should be printed in
a visitors browser. Index.html is
already existing.
Can you please help me?
#!/usr/bin/perl -w
my $counter=0;
my $reader=0;
if (! open (DH, "counter.cnt")){
print "Counter-Datei nicht vorhanden...Lege neue mit Wert null an\n";
open (DH, "> counter.cnt");
print (DH "$counter");
close;
};
open (DH, "< counter.cnt") or die "Fehler! $!\n";
unless (defined){
$reader=<DH>;
};
close DH;
$reader+=1;
# Debugging, folgende Zeile f�r Tests auskommentieren. Gibt eingelesenen,
erh�hten Z�hlerstand zur�ck.
#print "$reader"
open (DH, "> counter.cnt") or die "Fehler! $!\n";
print (DH "$reader");
close DH;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>