Actually, I think you would be better off solving this problem with Excel - it is possible to write macros that would do this.

You are going to be on a very steep learning curve with Perl. But to get you started, I would create a hash table out of file2. This will allow you to translate any TID into the SPNAME. Code below. Note how I limited the number of things coming out of the split(). You will need that technique to parse the first file, except there will be 3 fields instead of 2.
 my ($gid,$tid,$concat) = split(/\s+/,$_,3);

#!/usr/bin/perl -w use strict; use Data::Dumper; my %tid2spname; foreach (<DATA>) { chomp; my ($tid, $txt) = split(/\s+/,$_,2); $tid2spname{$tid} = $txt; } print Dumper \%tid2spname; __DATA__ 10090 Mus musculus 10116 Rattus norvegicus 148305 Magnaporthe grisea 28985 Kluyveromyces lactis 33169 Eremothecium gossypii 3702 Arabidopsis thaliana 4530 Oryza sativa 4896 Schizosaccharomyces pombe 4932 Saccharomyces cerevisiae 5141 Neurospora crassa 5833 Plasmodium falciparum 6239 Caenorhabditis elegans 7165 Anopheles gambiae 7227 Drosophila melanogaster 7955 Danio rerio 9031 Gallus gallus 9598 Pan troglodytes 9606 Homo sapiens 9615 Canis lupusfamiliaris 9913 Bos taurus

In reply to Re: Multiple loops and comparisions by Marshall
in thread Multiple loops and comparisions by sundeep

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.