$sth = $dbh->prepare(" Update tUser Set ? = ? Where UserId = $user_info{UserId} "); foreach $key(keys %user_info) { if ($key ne "UserId") { $sth->execute($key, $user_info{$key}); } } $sth->finish();