use strict; use warnings; use DBI qw( ); use File::Spec::Functions qw( catfile ); { my $db = '.'; my $dsn = "dbi:CSV:f_dir=$db"; my $user = undef; my $passwd = undef; my $dbh = DBI->connect( $dsn, $user, $passwd, { RaiseError => 1, PrintError => 0, PrintWarn => 1, AutoCommit => 1, # No writing, so no need for transactions. FetchHashKeyName => 'NAME_lc', } ); for (qw( Print )) { my $path = catfile($db, "$_.csv"); # Xyz and "Xyz" are erroneously considered different tables. $dbh->{csv_tables}{ $_ }{file} = $path; $dbh->{csv_tables}{qq{"$_"}}{file} = $path; } my $sth = $dbh->prepare(' SELECT id, gid, card, "set", illus, num FROM Print '); $sth->execute(); # ... }