use DBI; use Data::Dumper; my $dbh = DBI->connect("DBI:CSV:f_dir=C:/;csv_sep_char=\t") or die $DBI::errstr; $dbh->{'csv_tables'}->{'info'} = { 'file' => 'info.csv'}; my $sth = $dbh->prepare("SELECT PartID FROM info"); $sth->execute(); my %hash; while(my $test = $sth->fetchrow_hashref){ $hash{$test->{PartID}} = 1; } print Dumper(\%hash);