this post was submitted on 10 Jul 2023
3 points (100.0% liked)

Perl

184 readers
1 users here now

founded 1 year ago
MODERATORS
 

OK, why didn't anyone tell me about this module?

I do a lot of work with CSV and TSV files, usually pulling and transforming reports. My usual goto modules are Text::CSV::Slurp and when that's not enough, I use Text::CSV. Then, I do all of the data manipulation myself.

I'm finding that Data::CTable makes reading, modifying, and writing tabular data files almost trivially easy. I can act on the data row-by-row (of course) but also column-by-column. I can add, delete, re-arrange, and rename columns. I can select a subset of rows and then perform actions, like calculating the value of a new column, only on the selected rows. I can load two files and merge columns into a third, writing the result as a new CSV.

I wasn't even looking for this. I had been searching metacpan for "fixed width template" (which was satisfied with Text::Reform) when I stumbled on this module. The irony, is that it's exactly what I needed for a current work report due tomorrow!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago

Gonna have to check this out. I also make extensive use of Text::CSV. Looks like Data::CTable hasn't been updated since 2002, though.