I need help doing some basic arithmatic on some database values. Initially, I query my table for all product codes and quantity ( using DBI ). Then I display these non-editable values along with two editable fields for entering a value that will be added/subtracted from original quantity in a form (using CGI) so it looks something like this: Product Name | Quantity | Add | Subtract WidgetA | 10 | | . . . What I need to do happen when the form is submitted is take all the input in the add and/or subtract fields and do the appropriate math on the original quantity value, then store the newly calculated quantity back into the table. Can anyone please give me a good example to work with? #### use CGI; my $q = CGI->new; foreach my $parm ($q->param) { if ($parm =~ m/^add_(.*)$/) { sub adjust_qty($1, $q->param($parm)); } if ($parm =~ m/^sub_(.*)$/) { sub adjust_qty($1, -($q->param($parm))); } } sub adjust_qty { my ($key, $qty) = @_; my $sql = qq(update table set qty = qty + $qty where key = $key); # do you need DBI help here? }