foreach my $p( grep /^\d+$/, param() ) { # find the form value my $v = param( $p ); # execute the query $sth->execute( $v, $p ); }