You're using single quotes when you attempt to set the formula, but they won't allow your $row variable to be interpolated - you're ending up with a literal '$row' in the excel formula, rather than the value of $row. Instead of:
$worksheet->write_formula($row+2, 12, '=1-(K.($row+2)/J.($row+2))',$al
+ignPerc);
You probably want:
$worksheet->write_formula($row+2, 12, '=1-(K'.($row+2).'/J'.($row+2).'
+)',$alignPerc);
or:
my $row_two_right = $row + 2;
$worksheet->write_formula($row_two_right, 12, "=1-(K$row_two_right/J$r
+ow_two_right)",$alignPerc);
Look at the actual formulas in excel and verify that they are being correctly generated.