in reply to Comma problem

You should use a CSV module, I suggest Text::xSV. Your particular problem is that you need to write
print LOG qq{,"=EXACT(B24,D24)"}, "\n";
but that is just a guess.
Boris