I would try something like this untested code:
die "number of data items doesn't match column count" if @data != @table; local $" = q/,/; my @place_holders = ('?') x @data; my $sql = "insert into member_info (@table) VALUES (@place_holders)"; my $sth = $dbh->prepare($sql) or die "DBI->prepare failed: $DBI::errstr"; $sth->execute(@data) or die "DBI->execute failed: $DBI::errstr";
To me, that reads a lot better than your snippet...
In reply to Re: DBI SQL adding array of values
by edan
in thread DBI SQL adding array of values
by pmtolk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |