use strict; use warnings; use DBI; open my $fOut, '>', "delme" or die "Can't create deleme.txt: $!\n"; print $fOut <connect('dbi:CSV:', '', '', {f_file => 'delme'}); my $sth = $dbh->prepare("select * from delme"); $sth->execute(); while (my $row = $sth->fetchrow_hashref()) { print "$_: '$row->{$_}'\n" for sort keys %$row; print "\n"; } #### colour: 'Blue' comment: 'Comment with a comma, and stuff.' line: '1' name: 'Fred' colour: 'Green' comment: 'No comma so no need for quotes' line: '2' name: 'Joe' colour: 'Red' comment: '"A comma, and quotes"' line: '3' name: 'Bob' colour: 'Yellow' comment: 'Penultimate line, but split across two input lines' line: '4' name: 'Sam' colour: 'Violet' comment: 'And an ordinary line to finish' line: '5' name: 'Bill'