while (my @row = $queryHandle->fetchrow) { my $reftype = ref $row[0]; # now see if it's an array, if so see it's scalar count if ($reftype eq 'ARRAY'){ my $count = scalar $reftype; } # now loop thru all the array by $count foreach my $cnt( 0.. $count){ $dude2->insert("end", $row[0][$count] ); ... .... } ..... ..... }