post データが
a0=1&b0=1&a1=4&b1=2&a2=2&b2=2&・・・&an=8&bn=9
と"a".$i =数字と"b".$i=数字となっているものを
postgresql にperl でupdateしたいのですが、

for($i=0;$i < n; $i++){
$str ="update table set a=$html->param('\"a\".$i') where b=$html->param('\"b\".$i)";
$sth=$dbh->prepare($str);
$sth->execute();
}
こんな感じでupdateしたいのですが,試行錯誤の上に挫折中です。
うまい方法はないですか?