Ive had a breakthrough!
I changed the following code from $rec to $in. and it works! I also divided the total by 86400 to get back to days since last visit.
my ($status, $line, @lines, @data, $output, $found, $restricted);
$compare1 = &date_to_unix($rec{'date'});
$compare2 = &date_to_unix($rec{'currentdate'});
$total = $compare2-$compare1;
$in{'food'} = $in{'food'} + $in{'addfood'} + $total;
to
my ($status, $line, @lines, @data, $output, $found, $restricted);
$compare1 = &date_to_unix($in{'date'});
$compare2 = &date_to_unix($in{'currentdate'});
$total = $compare2-$compare1;
$in{'food'} = $in{'food'} + $in{'addfood'} - ($total/86400);
See, i'm learning.
carl
I changed the following code from $rec to $in. and it works! I also divided the total by 86400 to get back to days since last visit.
Code:
sub modify_record { my ($status, $line, @lines, @data, $output, $found, $restricted);
$compare1 = &date_to_unix($rec{'date'});
$compare2 = &date_to_unix($rec{'currentdate'});
$total = $compare2-$compare1;
$in{'food'} = $in{'food'} + $in{'addfood'} + $total;
to
Code:
sub modify_record { my ($status, $line, @lines, @data, $output, $found, $restricted);
$compare1 = &date_to_unix($in{'date'});
$compare2 = &date_to_unix($in{'currentdate'});
$total = $compare2-$compare1;
$in{'food'} = $in{'food'} + $in{'addfood'} - ($total/86400);
See, i'm learning.
carl