or download this
my $ins_rec = "INSERT INTO $tbl_name (col1, col2, col3, col4, col5, co
+l6, col7) VALUES (?,?,?,?,?,?,?);";
...
$sth=$dbh->prepare($ins_rec) or die $dbh->errstr;
$sth->execute($col1, $col2, $col3, $col4, $col5, $col6, $col7) or die
+$sth->errstr;