If you're just processing each line separately, I would think the easiest way, especially for large files, would be
- open the first file
- open an output file
- then read a line from the first file,
- process the line, including converting to fields or editing the fields in place
- write the line to the new file.
If no errors, the new file contains all the processed data.
Text::CSV shows an example of testing a field in place right at the top of the perldoc. It's also the best tool for CSV files.
--marmot