Hi,

I'm a humble biologist who has just started to learn Perl (using Sam's 21 days book - I'm only on day seven!) and I need some help with a specific aspect of a script I'm trying to write (just a push in the right direction will do)

Briefly - I need to take two txt files, each with a list of names. There is some redundancy across these two lists (i.e some names appear in both lists) and that is the problem. I need to extract the names from both files (I think I know how to do this - I was just going to put the list of names from each file into two arrays, respectively)and then compare the elements of the arrays and somehow then output a file where it lists each name from both arrays only once (i.e remove the redundancy where a given name appears in both files). The part I need help with is which function/s I could use to only list the names that appear in both lists once (and also include the names that appear in only one of the lists). I hope that was clear.

Any help or a hint would be greatly appreciated. Cheers, Anna


In reply to help with a function that will cut out redundancy across two lists by annakarenina83

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.