I'm a little confused on the proper way to handle information stored in an array. I'm trying to access a 4 field array, increment one field and perform an addition on another. Then save the array again with the new info. I can pull the array fine. I can get the math to show the correct info, but when I push the array back up, it doesn't store the new values.
Here is what I'm trying to do: I want to get a record of everytime certain users submit with a simple counter. Then I want to store a second field (numerical) and at the same time,add it to the last value, eventually giving a total # for that field.
Here is the code I've got so far, but I think I'm calling the fields wrong:
open (DB, ">>/users/support/www/docs/cgi-bin/dbman2/ajcen.db");
@temp = <DB>;
@values = split (/\|/);
$temp[0] = ++$temp[0];
$temp[1] = $temp[1] + 5;
print DB &join_encode(%in);
close DB;
This will always be a static db file and will only be accessed when that user submits, so I'm not worried about file locking. The 5 will eventually be replaced by a variable, but I made it static while I was testing. Am I on the right track here, or completely wrong? As far as I'm concerned, the simpler this script is the better, because it doesn't have to do much and there are no scenarios that could make it fail. The code would be appreciated, but if it would be nice you could explain it, I'd like to figure this stuff out.
Thanks,
KipT - Perl novice thrown to the wolves
Here is what I'm trying to do: I want to get a record of everytime certain users submit with a simple counter. Then I want to store a second field (numerical) and at the same time,add it to the last value, eventually giving a total # for that field.
Here is the code I've got so far, but I think I'm calling the fields wrong:
open (DB, ">>/users/support/www/docs/cgi-bin/dbman2/ajcen.db");
@temp = <DB>;
@values = split (/\|/);
$temp[0] = ++$temp[0];
$temp[1] = $temp[1] + 5;
print DB &join_encode(%in);
close DB;
This will always be a static db file and will only be accessed when that user submits, so I'm not worried about file locking. The 5 will eventually be replaced by a variable, but I made it static while I was testing. Am I on the right track here, or completely wrong? As far as I'm concerned, the simpler this script is the better, because it doesn't have to do much and there are no scenarios that could make it fail. The code would be appreciated, but if it would be nice you could explain it, I'd like to figure this stuff out.
Thanks,
KipT - Perl novice thrown to the wolves

