my $tstr = '?'; my $tv = join (', ', @table); for (1..$#table) { $tstr.=', ?'; } my $sth = $ebh->prepare("INSERT INTO member_info ($tv) VALUES ($tstr)") or die "Unable to prepare statement: ($DBI::err) $DBI::errstr"; if (scalar @data = scalar @table) { $sth->execute(@data) or die "No exec: ($DBI::err) $DBI::errstr"; } else { warn("\@data is not the same size as \@table; tried to put ".scalar @data." items into ".scalar @table." columns."); }