in reply to MySQL and PERL tribulations....
Why not create your whole INSERT statement via a sprintf before the 'do'? You could then check it for SQL syntax accuracy and also the contents of your variables (perhaps all you need is to use the $db->quote($sql_string) method).
Try running with PrintError =>1 in your connection statement as well (can't hurt might help)
What is in the $rows variable? BTW this $rows scalar is a little misnamed in that if no rows affected then the variable may well contain '0E0'- not 0! Which also of course is 'true' not 'false' - not necessarily what you want.
I could lie down like a tired child,
And weep away the life of care
Which I have borne, and yet must bear. Shelley 1792-1822