use DBI; # connect to the database my $dbh = DBI->connect('dbi:ODBC:foo', 'username', 'password') or die "Can't connect: ", $DBI::errstr; # prepare a SQL statement to insert your data # (using placeholders ("?") so you only have to # compile the statement once) my $sth = $dbh->prepare(<errstr; insert into data (data_1, data_2) values (?, ?) SQL # open up your data file open FH, "data_file" or die "Can't open: $!"; while () { chomp; # parse your data out of the file my($d1, $d2) = split /\t/; # assuming tab-separated data # mess around with your data here # .... # insert your data into the database $sth->execute($d1, $d2); } close FH; $sth->finish; $dbh->disconnect;