#!/usr/bin/perl ### Strange MySQL Error ### use warnings; use CGI; use DBI; print "Content-type: text/html\r\n\r\n"; my $time = localtime; my $driver = "DBI:mysql:foo"; my $username = "bar"; my $password = "baz"; $dbh = DBI->connect($driver, $username, $password) or die $DBI::errstr; open(F, "file.txt") or die; while(){ $bat = somefunction($_); my $entry_added = $dbh->do("INSERT INTO `foo`.`table` (`boo`, `bat`) VALUES ('$_', '$bat')", undef, 'DONE') or &dbdie; }