use DBI; my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { f_dir => "Results/Classification", f_ext => ".txt/r", csv_sep_char => "\t", RaiseError => 1, PrintError => 1, }) or die $DBI::errstr; my $sth = $dbh->prepare ("select max (begin) from classesNormal where nr = 2"); $sth->execute; my ($max) = $sth->fetchrow_array;