in reply to Re: wrong output
in thread wrong output

In the spirit of further simplification (and, just as important, encapsulating the output), this
printf $outFile "Success,"; print "In Success,\n"; my $ErrorMsg = "null"; while ($line = <DATA>) { if ($line =~ /$match/) { print "$2\n"; printf $outFile "$2, ${1}, $ErrorMsg\n"; return; } }
could be converted to a subroutine that would have parameters of "Success" and "null" (or "Error" and $1) passed to it.