in reply to Update mysql row with a hash

Something like this, maybe?

# Transform hash into two arrays my @fields = keys %{$record_ref}; my @values = map { $record_ref->{$_} } @fields; my $sql = "UPDATE $table SET " . join( '=?,', @fields ) . "=? WHERE $clauza_where"; # print "sql=",$sql,"\n"; eval { $sth = $dbh->prepare($sql); $sth->execute(@values); $dbh->commit; # commit the changes if we get this far }; if ($@) { warn "Transaction aborted because $@"; $dbh->rollback; # undo the incomplete changes }

Update: fixed small typo regarding unmatched right curly bracket