http://qs321.pair.com?node_id=11106995


in reply to Re^2: Perl script for the post processing of one CSV file
in thread Perl script for the post processing of one CSV file

You can stream it and prevent memory hogs on big data. Additionally, install Text::CSV_XS for speed use Text::CSV_XS "csv";

Install Text::CSV_XS, yes, but don't explicitly use Text::CSV_XS. Text::CSV is smart enough to pull in the XS version if installed, and will fall back to pure Perl if not. There is usually no point in having the script break if XS isn't available.

perl -MText::CSV -e 'print Text::CSV->module' Text::CSV_XS

I agree with your streaming suggestion. I had opted to keep my example simple given the 20k line input. Good to teach the streaming approach, though. ++

use strict; use warnings; omitted for brevity.