use strict; use warnings; my @st_n; while (defined (my $line = )) { my @array = split(/,/ , $line); my $test = @array; next if $test < 6; # Skip lines that don't have at least 6 fields my $store_number = $array[1]; print "$array[5] offers and $test is number of elements\n"; if ($array[5] =~ /0000000/ || $array[5] =~ //) { # the 2nd part is obviously wrong print "$store_number is not BCE Store\n"; } else { print "Store # $store_number\n"; push(@st_n, $store_number); } } __DATA__ 20060819,02159,045488061,00 ,0000118,0000000,0000000,0000118,0000000,0000000,Zachary ,G 20060819,02159,045775830,00 ,0000649,0000028,0000000,0000649,0000028,0000000, , 20060819,02161,023416381,09 ,0000034,0000000,0000000,0000034,0000000,0000000,Erinne ,H