in reply to MySQL UPDATE in PERL

You could also use the MySQL REPLACE INTO command which is actually quite useful for stuff like this. Of course, the syntax is different from INSERT INTO which might be the source of your confusion.