You do not have to backslash a comma, it has no special meaning in a regexp. Also, you can fire the substitution right ahead without testing it will succeed - if it does not, nothing happens.
my $grossAmt = param("amt");
if ($grossAmt =~ s/,//g) {
$grossAmt = sprintf '%.2f', $grossAmt;
}