I don't completely understand your requirements either, but I'll take a stab. You'll probably end up with multiple arrays of arrays, right -- one for each unique value in the first column? In other words, for the value KN-1791-LAST_rep_c7834 you could have an array of arrays, but then there will be another for the next different value found in column 1, and so on. In that case, I suspect you really want a hash of arrays of arrays (HoAoA), keyed on that column 1 value. Or perhaps, once you've built an array of arrays for a particular column 1 value, you can go ahead and print it out or do whatever you need to do with it, and be done with it? I can't really tell.

It's also not clear what you mean by "a difference of 10", since you didn't give an example like that, and I don't know what you mean by a "false positive." Maybe you could give a longer sample of your input data (10-12 lines) and what you would expect the output to look like, and get some advice on the best way to get there.

One likely problem, code-wise: this line (below) doesn't make an array of arrays, as you may be expecting. It pushes the values in the second array onto the end of the first array, leaving it one-dimensional. To get an array of arrays, you would push a reference to your sub-array onto the first one, like in my second line:

push (@arrayEquals, @array); # just makes the array longer push @arrayEquals, [@array]; # makes an array of arrays

Aaron B.
Available for small or large Perl jobs; see my home node.


In reply to Re: Accessing 2D array values and comparing by aaron_baugher
in thread Accessing 2D array values and comparing by mSe

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.