I'm not quite sure what you are after, but this may get you going. Note the technique of including data in a __DATA__ section in the script to facilitate testing - especially by other people.
use strict; use warnings; my @st_n; while (defined (my $line = <DATA>)) { 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,0 +000000,Zachary ,G 20060819,02159,045775830,00 ,0000649,0000028,0000000,0000649,0000028,0 +000000, , 20060819,02161,023416381,09 ,0000034,0000000,0000000,0000034,0000000,0 +000000,Erinne ,H
Prints:
0000000 offers and 12 is number of elements 02159 is not BCE Store 0000028 offers and 11 is number of elements Store # 02159 0000000 offers and 12 is number of elements 02161 is not BCE Store
In reply to Re: Array element exist
by GrandFather
in thread Array element exist
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |