#!/usr/bin/perl -w use strict; use warnings; use DBI; my $dir = '.'; my $eol = "\n"; my $sep = ','; my $dbh_match = DBI->connect ( "DBI:CSV:", undef, undef, { f_dir => $dir, f_ext => ".csv/r", csv_eol => $eol, csv_sep_char => $sep, RaiseError => 1, PrintError => 1, } ) or die "Cannot connect: " . $DBI::errstr; my $sth_match = $dbh_match->prepare ( qq| CREATE TABLE new AS SELECT file_01.Prefix, file_01.NumberRange, file_02.Termination, file_02.Service, file_02.ChargeBand FROM file_01 INNER JOIN file_02 ON file_01.Chargeband = file_02.ChargeBand WHERE file_02.Termination LIKE '%something%' | ); $sth_match->execute or die "Cannot execute: " . $sth_match->errstr (); DBI->trace (1); $dbh_match->disconnect;