Hi monks, I'm getting a bit confused!

I simply have two arrays of numbers which are 'paired' together based on element number, e.g. $array1[0] and $array2[0] are a pair etc.

My problem is that, although each array holds unique numbers, these numbers are sometimes present in both arrays. When this happens, I simply want to remove one copy of the pair and keep the other (remove one element from each array)

Here's an example:

@array1 = qq(13470660 13471850 14028274 14028286); @array2 = qq(14028145 14028286 13476691 13471850); # where the pairs are: 13470660 14028145 13471850 14028286 14028274 13476691 14028286 13471850 # I want the result to be the following because 14028286 13471850 occu +r in each: 13470660 14028145 13471850 14028286 14028274 13476691
Thanks!

Edited by davido: Wrapped $arrayn[0] notation in code tags.


In reply to comparing arrays 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.