my $EDITOR doesn't do tabs, but I think this will be ok:
my ( %merged, %evalues, %lowest ); while ( <DATA> ) { chomp; my ( $evalue ) = m/\s(\S+)$/; my ( $k, $v ) = split /\s+/, $_, 2; $merged{$k} = $merged{$k} ? "$merged{$k}\t$v" : $v; if ( ! exists $evalues{$k} || $evalue < $evalues{$k} ) { $evalues{$k} = $evalue; $lowest{$k} = $_; } } open my $f1, ">", "file1~" or die $!; print $f1 "$_\t$merged{$_}\n" for sort keys %merged; open my $f2, ">", "file2~" or die $!; print $f2 "$lowest{$_}\n" for sort keys %lowest; __DATA__ Q3KIL4_PSEPF ONE 134 380 1 252 216.3 6.3e-64 Q3M236_ANAVT TWO 107 563 1 468 203.2 5.3e-60 Q3M236_ANAVT THREE 250 494 1 277 219.1 8.6e-65 Q3M5F5_ANAVT FOUR 296 608 1 355 166.2 7.4e-49 Q3M5F5_ANAVT FIVE 299 584 1 304 188.2 1.7e-55 Q3M7Z1_ANAVT SIX 51 181 1 140 99.0 1.2e-28 Q3MAD2_ANAVT SEVEN 107 508 1 468 350.1 3.3e-104 Q3MAD2_ANAVT EIGHT 230 457 1 277 201.1 2.3e-59 Q3MBT3_ANAVT NINE 203 606 1 468 102.5 1.1e-29 Q3MBT3_ANAVT TEN 326 559 1 277 221.6 1.6e-65 Q3MBT3_ANAVT ELEVEN 134 333 1 234 -334.1 2.7e-44 Q3MD63_ANAVT TWELVE 173 491 1 355 248.5 1.2e-73

I'll leave it up to you to read from a file instead of __DATA__


In reply to Re: how to combine? by FunkyMonk
in thread how to combine? 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.