in reply to Writing to a New File
In order to have it properly interpreted as a number, you need to remove the leading "count=" part after having read the line from the file... — something like this
my $flashcount_file = "/var/www/html/log/flashcount.txt"; open my $flashcount, "<", $flashcount_file; my $count = <$flashcount>; $count =~ s/^count=//; # <-- remove "count=" $count++; close $flashcount; open my $flashcount, ">", $flashcount_file; print $flashcount "count=$count"; close $flashcount;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing to a New File
by ikegami (Patriarch) on Jan 29, 2008 at 00:58 UTC |