in reply to SQL Update Error

Your code is very very hard to read. I have reformatted it as the following to make the structure more apparent:

my $up = "UPDATE Prior_to_CI_calc_A_$region SET SUM_wi = $SUM_Weight_wi, Sum_wixi_x_1000 = $SUM_wixi_x_1000_fill, Sum_wi2xi_x_1000 = $SUM_wi2xi_x_1000_fill FROM Prior_to_CI_calc_A_$region A WHERE A.Aggregated_area LIKE '$Aggregated_area_fill' AND A.Cause LIKE '$Cause_fill' ";

You are creating SQL on-the-fly and I'm not sure your SQL syntax is correct, as I don't know the combination statement modifiers you use. I think that your error is most likely because one of your several embedded variables is empty or undefined. I recommend that you follow one of the two following paths: