in reply to How do I assign a variable to the file content?

Keeping in mind all of Corion's expert advice, here's a working version of your code, assuming counttext.txt exists and is accessible:
#!/usr/local/bin/perl -w use strict print "Content-type: text/html\n\n"; my $counttext = 'd:/xxx.xxx.xxx.xxx/perl/thecounter/counttext.txt'; my $thenumber; open(COUNTTHIS, "< $counttext") or die "I can't open counttext: $!\n"; $thenumber = <COUNTTHIS>; close(COUNTTHIS); print "$thenumber<br>"; ++$thenumber; print "$thenumber"; open(OUT, "> $counttext") or die "I can't open counttext: $!\n"; print OUT $thenumber; close(OUT);

Replies are listed 'Best First'.
RE: Answer: How do I assign a variable to the file content?
by NotProud (Novice) on Sep 25, 2000 at 21:15 UTC
    Thanks alot to both of you.