in reply to DBI SQL adding array of values

First, let me help you. You're working much too hard. That first bit of code should go like this:

my $tstr = join(',', ('?') x @table); my $tv = join(',', @table);

Now your error comes when you try to call execute using @data:

$sth->execute( @data) || die("Error: Can't execute: $DBI::errstr +");

I'm pretty sure this is happening because @data has one less item than @tables. Try putting this before the execute:

die "Hey, \@data should have " . scalar(@table) . " values but it only has " . scalar(@data) . "!" if @data != @table;

The error message generated should explain the problem to you. If not, post more code and maybe the real problem will be more clear.

-sam