use DBI my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { f_ext => ".txt/r", f_encoding => "utf-8", csv_sep_char => "\t", # more options available RaiseError => 1, }); my $sth = $dbh->prepare ("select * from test"); $sth->execute; while (my @row = $sth->fetrow_array) { # do something with the fields } #### use Text::CSV_XS; my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1, sep_char => "\t" }); open my $fh, "<:encoding(utf-8)", "test.txt" or die "test.txt: $!"; while (my $row = $csv->getline ($fh)) { # do something with @$row } close $fh;