my $data = qq(INSERT INTO temp (url, altavista, yahoo, msn, teoma, google, alltheweb, Total) values("$url", "$altavista_results", "$yahoo_results", "$msn_results", "$teoma_results", "$google_results", "$alltheweb_results", "$total") ON DUPLICATE KEY UPDATE altavista = "$altavista_results", yahoo = "$yahoo_results", msn = "$msn_results", teoma = "$teoma_results", google = "$google_results", alltheweb = "$alltheweb_results", total = "$total"); my $sth = $dbh->prepare($data); $sth->execute() or die $dbh->errstr;