#!/usr/bin/perl -w use strict; use CGI qw/:standard/; my @acc_list = (00001 .. 1000); # this will have at lest 20000 accout numbers in if (!@acc_list) { die " Nothing at this time";exit; } # From 1 table my $c_1=0; my $tb1; while ( @acc_list ) { $c_1++; my @files1 = splice( @acc_list, 0, 100 ); print "\n23 - @files1\n"; #my $holders_one = join ',', ('?') x @files1; #$tb1 = $dbh->exec_select( qq|select * from table1 where acc in ($holders_one)|,@files1 ); } foreach (@$tb1) { print "\n1- Found 1\n"; } print "\n\n 33 - @acc_list \n\n"; # From 2 table my $c_2=0; my $tb2; while ( @acc_list ) { $c_2++; my @files2 = splice( @acc_list, 0, 100 ); #my $holders_two = join ',', ('?') x @files2; #$tb2 = $dbh->exec_select( qq|select * from table2 where acc in ($holders_two)|,@files2 ); } foreach (@$tb2) { print "\n 2- Found 2\n"; } print "\n\n 52 - @acc_list \n\n"; # From 3 table my $c_3=0; my $tb3; while ( @acc_list ) { $c_3++; my @files3 = splice( @acc_list, 0, 100 ); #my $holders_three = join ',', ('?') x @files3; #$tb3 = $dbh->exec_select( qq|select * from table3 where acc in ($holders_three)|,@files3 ); } foreach (@$tb3) { print "\n 3- Found 3\n"; } print "\n\n68 - **@acc_list** \n\n"; print "\n\n Done \n\n";