Hi, I have two files with a great deal of data. The two files have a common alpha-numeric field and one of the files has a numeric field that is associated with the common alpha-numeric field. I would like to search the file with both values and return a version of the file missing the numeric field that has the numeric field and the alpha-numeric field. Each number corresponds to a particular alpha-numeric field. I cannot figure out how to make this happen. I have tried splitting the arrays and comparing the two with an if statement but I either get no results or undesirable ones. Would someone be able to help me with this? Thank you so much in advance. Also, this is the code that I tried. Sorry that I didn't include it earlier. It obviously has some problems. I'm just not sure how to go about correcting them.

!#/usr/bin/perl -w open (IN, "C:/work/job2/Ab2SigmaGene.txt"); while (<IN>){ #start while loop chomp; @t=split(/\t/,$_); $t[4]= $AB{[4]}; } #end while loop close IN; open (OUT, ">C:/work/job2/XP725a.txt"); open (IN, "c:/work/job2/XP725_Ab_array.txt"); while (<IN>){ #start chomp; @var1=split(/\t/,$_); if ($var1[2] and exists $Ab{$var1[2]}){ print OUT "$var1[0]\t$var1[1]\t$var1[2]\t$AB[4]\n";} } #end close IN; close OUT;

In reply to Compare Arrays, Return Values by de2425

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.