#!/usr/bin/perl use strict; use warnings; use DBI; # Connect to the database, (the directory containing our csv file(s)) my $dbh = DBI->connect("DBI:CSV:f_dir=../prospects.csv;csv_eol=\n;"); # Associate our csv file with the table name 'prospects' $dbh->{'csv_tables'}->{'prospects'} = { 'file' => 'prospects.csv'}; # Output the name and contact field from each row my $sth = $dbh->prepare("SELECT * FROM prospects WHERE name LIKE 'G%'"); $sth->execute(); while (my $row = $sth->fetchrow_hashref) { print("name = ", $row->{'Name'}, " contact = ", $row->{'Contact'}. "\n"); } $sth->finish();