$ cat data/objectives-cqdc.txt Obj~PosNbr~Year~Div~AVP~Dept~SDescr~Major~Methods~Results~Accompl~JanUp~LDescr~Changes~Chars~Goals~Budget~CFObj 20140000020~00001576~2014~"testdata"~"testdata"~"testdata"~-~0~-~"Inserted on December 10, 2013"~-~-~-~-~20000000001~20130000001~1~- $ cat test.pl use 5.16.2; use warnings; use DBI; use Data::Peek; my ($Cposition, $Cyear) = ("00001576", 2014); my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { f_dir => "data", f_ext => ".txt/r", csv_sep_char => "~", }); my $sth = $dbh->prepare (qq{select * from "objectives-cqdc" where PosNbr = ? and year = ?}); $sth->execute ($Cposition, $Cyear); while (my $row = $sth->fetchrow_hashref) { DDumper $row; } $ perl test.pl { accompl => '-', avp => 'testdata', budget => 1, cfobj => '- ', changes => '-', chars => '20000000001', dept => 'testdata', div => 'testdata', goals => '20130000001', janup => '-', ldescr => '-', major => 0, methods => '-', obj => '20140000020', posnbr => '00001576', results => 'Inserted on December 10, 2013', sdescr => '-', year => 2014 } $ #### use DBI; use Data::Peek; my ($Cposition, $Cyear) = ("00001576", 2014); my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { csv_sep_char => "~", csv_tables => { JPDObj => { f_file => "data/objectives-cqdc.txt", col_names => [qw( Obj PosNbr Year Div AVP Dept SDescr Major Methods Results Accompl JanUp LDescr Changes Chars Goals Budget CFObj )], }, } }); my $sth = $dbh->prepare (qq{select * from JPDObj where PosNbr = ? and year = ?}); $sth->execute ($Cposition, $Cyear); while (my $row = $sth->fetchrow_hashref) { DDumper $row; }