in reply to Receinving hash where expecting a string

$valuestring .= $db->quote({$_}) .",";
that should give a warning
Odd number of elements in anonymous hash at...
Since {$_} in this instance creates a hash with a single key "$_" and no value.

You want quote($_) instead, though you're probably a lot better off using placeholders.

I.e. something like:

$db->prepare("INSERT INTO bla col=?, othercol=? ..."); $db->execute($value1,$value2 ...);
Update: I see that you're using the {$_} in more places, usually where you seem to want $cols{$_} instead. Maybe you should take more notice of the webserver's error log. Or use CGI::Carp 'fatalsToBrowser'; use warnings FATAL=>'all'; or something similar.