in reply to Parse one file, send the records to two different files

But my "error" file ends up with 8 million records in it! So I've got something I'm missing here and I was hoping another pair of eyes would catch it.

You're printing the wrong array (@data instead of @fields) to your errors file.

# split the fields of each record my @fields = split(/,/, $line); # Check if the storeNbr field is empty. If so, write record to er +ror file. if (!length $fields[28]) { print $ERR_FH join (',', @$_), $/ for @data; }

@data is where you're accumulating your good records; and every time you find a bad record, you're writing all the good records you've accumulated so far into your errors file, instead of the single bad record.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.