in reply to Re^3: Text::CSV_XS and blank lines
in thread Text::CSV_XS and blank lines

Tell me if that would work for you ...

Well, it would work for me, but I'm not the OP, constantreader. He or she wrote, "Ideally, it would be nice if it returned an empty hashref." But I think I understand why this wouldn't work as it requires distinguishing between a CSV record with a single empty field in it and an unwanted blank line, something that Text::CSV_XS can't possibly do — at least not without using the IO::Telepathy module.

Perhaps a better, more generally useful feature would be the ability to assert a specific number of expected fields, either explicitly or implicitly via the column_names method, and then to have some elegant, built-in error checking of the parsed CSV record against the assertion.

After all, aren't most CSV files in the world essentially flat-file database tables with a constant number of fields in each record — else something is wrong?