Hi, I'm trying to write a subroutine that:
1- opens a file to
overwrite a single variable in an array.
(of course it should lock the file too).
# example:
$flock = "y";
$RECORD = "data.db";
open (DAT,">$RECORD/$form{'User'}");
if ($flock eq "y") {
flock DAT, 2;
}
2- reads the file and go to a ceratin array
based on the input from a FORM (NAME="USER")
# example of array format
USER:FNAME:LNAME:EMAIL:COUNT
3- overwrites the last variable ($COUNT)
by subtracting one from the initial value
($COUNT--) only if it's greater or equal to one
($COUNT>=1) but if it's equal zero($COUNT=0)
it should print to an html document the variable value =0.
4-after ovewriting ($COUNT) it prints
the new value to an html document.
#example
print "count is now equal to $COUNT\n";
Please, Can anyone help me put this sub together?!!