#Original variable @numbers = (1,2,3,4); #so lets say the code actually created array variables @array1 @array2 @aaray3 @array4 #Each of these variables will be assign certain amount of elements. The arrays will be used in a SQL statment like this for ($i = 1;$i < 5;$++) { print FINAL "create table bce.week_g${last_4_chars}v00_temp$i as\n". "select distinct(a.FILEDATE), a.RPTSTORE, b.LOC_N\n". "From bce.week\n". "where ID in (@{'array'}$i);"; }