my $sth=$dbh->prepare("insert into table mytable (name,value) values (?,?)"); foreach (param()) { $sth->execute($_,param($_)); # will only insert the first value if a variable has multiple values }