#!/usr/bin/perl -w my $dbh = open_admin(); my $table ="test"; my $year = "2018"; my %updates = (); my $k =7749; my $new = q["Boop, Betty"]; ## 'Boop, Betty'; $updates{$k}{name} = $new; $updates{$k}{age} = 33; foreach my $id ( keys %updates ){ my $update = ""; $update .= "UPDATE $table SET "; my @binds = (); my $i = 0; foreach my $fn ( keys %{$updates{$id}} ) { $update .= " $fn=?, "; $binds[$i] = $updates{$id}{$fn}; $i++; } push @binds, $k; $update .= "WHERE course_id =? AND year=$year"; my $xbinds = join ", ", @binds; print "update [$udate]\n"; print "binds --> {$xbinds }\n"; my $sth = $dbh->prepare($update); $sth->execute(@binds, $id); } exit;