in reply to simple MySQL prob

MySQL INSERT will fail if you try to form a new record with a duplicate of a unique field. It's poor form to rely on error conditions for program logic, so the two step process of jeffa and screamingeagle is best.

If you instead wish to only replace NULL values in an existing record,

my $sth=$dbh->prepare('UPDATE db SET foo=IF(foo IS NULL,?,foo) WHERE k +ey=?');
Note the distinction between INSERT and UPDATE, INSERT creates new records, UPDATE modifies existing ones.

After Compline,
Zaxo