in reply to DBI SQL adding array of values

This really isn't pertinent to your question, but everytime I see code like

for(0..$size-1){ $tstr=$tstr."?,"; $tv=$tv.@table[$_].","; } chop($tstr); chop($tv);
it triggers my gag reflex :) Also, you're using @table[$_] when you clearly want $table[$_] Such things are better written thusly:
my $tstr = join ',', ("?") x @table; my $tv = join ',', @table;

But, back to your question ... are you sure that @data has the exact same number of elements as @table?