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

DWIM is Perl's answer to Gödel

In reply to Re: Array element exist by GrandFather
in thread Array element exist by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.