Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^2: Text::CSV on Unicode file

by dd-b (Monk)
on Jun 07, 2017 at 23:29 UTC ( [id://1192309] : note . print w/replies, xml ) Need Help??

in reply to Re: Text::CSV on Unicode file
in thread Text::CSV on Unicode file

And adding "nothing.nothing" to the end of the header line (so there isn't that trailing comma, but without changing the number of commas) made zero difference to the output, still get the exact same error.

Replies are listed 'Best First'.
Re^3: Text::CSV on Unicode file
by Tux (Canon) on Jun 09, 2017 at 06:29 UTC

    You can auto-generate headers for empty fields:

    my @hdr = $csv->header ($fh, { munge_column_names => sub { state $i; $_ || "nothing.".$i++ }});

    That would result in these headers:

    Volume.label Volume.serialno Volume.vtype Volume.netname Volume.filesystem nothing.0 Thumbnail.checksum Thumbnail.width Thumbnail.height Thumbnail.horiz_res Thumbnail.vert_res Thumbnail.colortype Thumbnail.colordepth Thumbnail.gamma Thumbnail.thumbnail_width Thumbnail.thumbnail_height Thumbnail.thumbnail_type Thumbnail.thumbnail_size Thumbnail.metric1 Keywords.pkeywords nothing.1

    Enjoy, Have FUN! H.Merijn