#!/usr/bin/perl use strict; use warnings; #use 5.014; use DBI; my $dbh = DBI->connect(qq{DBI:CSV:}); $dbh->{'csv_tables'}->{'animals'} = { 'file' => 'o33.txt', 'col_names' => [qw/animal size/], 'sep_char' => ","}; my $sth = $dbh->prepare(qq{ SELECT animal FROM animals WHERE size = Big }); $sth->execute() or die "Cannot execute: " . $sth->errstr(); while(my @row = $sth->fetchrow_array) { print "@row\n"; } $sth->finish(); $dbh->disconnect(); __END__ o33.txt Dog,Big Dog,Medium Dog,Small Rabbit,Huge Rabbit,Tiny Rabbit,Middle Donkey,Massive Donkey,Little Donkey,Gigantic