D
\Dandy\ Randy
Hello peoples,
Needs some help getting a ... well ... pretty basic math script working but
the solution eludes me .... I have a text file called opened.txt ... it
contains the following single line data:
2000|0|0
What I am looking to do is when the script is run, I would like the second
value to increase by 1 .... kind of like this:
#!/usr/bin/perl
open (FILE, "<opened.txt") or &error("Unable to open");
$data=<FILE>;
chomp ($data);
($total,$opened,$closed)=split(/\|/,$data);
close(FILE);
$opened = $opened + 1; // is incorrect of course
open (FILE, ">opened.txt") or &error("Unable to open");
print FILE "$total|$opened|$closed";
close(FILE);
print "Content-type: text/html \n\n";
print "All done";
exit;
So now the data in opened.txt would read:
2000|1|0
Can you please help me with the syntax to increase the second value when the
script is run. Thanx!
Randy
Needs some help getting a ... well ... pretty basic math script working but
the solution eludes me .... I have a text file called opened.txt ... it
contains the following single line data:
2000|0|0
What I am looking to do is when the script is run, I would like the second
value to increase by 1 .... kind of like this:
#!/usr/bin/perl
open (FILE, "<opened.txt") or &error("Unable to open");
$data=<FILE>;
chomp ($data);
($total,$opened,$closed)=split(/\|/,$data);
close(FILE);
$opened = $opened + 1; // is incorrect of course
open (FILE, ">opened.txt") or &error("Unable to open");
print FILE "$total|$opened|$closed";
close(FILE);
print "Content-type: text/html \n\n";
print "All done";
exit;
So now the data in opened.txt would read:
2000|1|0
Can you please help me with the syntax to increase the second value when the
script is run. Thanx!
Randy