I have this project that's kinda urgent and I still have not much idea how to do it. What i'm supposed to do, is to take a file that looks like this:

# STOCKHOLM 1.0 #=GF ID 1-cysPrx_C #=GF AC PF10417.4 #=GF DE C-terminal domain of 1-Cys peroxiredoxin #=GF AU Finn RD, Coggill PC #=GF SE Gene3D, pdb_1prx ... #=GS A3EU39_9BACT/160-195 AC A3EU39.1 #=GS Q7VQB3_BLOFL/159-194 AC Q7VQB3.1 #=GS Q057V5_BUCCC/160-195 AC Q057V5.1 #=GS A5CDZ8_ORITB/160-195 AC A5CDZ8.1 ... // Similar set of data with different numbers.

so the final file i need is one with this:

A3EU39 | PF10417.4/ PF10000.3 Q7VQB3 | PF10417.4/...

I also have a file with a list of these 6digit numbers/letters and i have to arrange them in that order. At first i wanted to go through the file each time, but both files are large so i have to try and just run once through. So i was thinking a hash. like a hash with Q7VQB3->PF10417.4/.....

But to be honest, i have no idea how to. I'm sorry but i'm really new. i was thinking

my %hash; open PFAMDB, "C:\\Users\\Jems\\Desktop\\Perl\\Pfam-A.seed" or die $!; #thats the main file. while (my $pfam=<PFAMDB>){ my @units= split /#/,$pfam; if ($pfam=~ =GF AC){my $pf=$pfam;} if ($pfam=~ \sAC\s){if exists $hash{$pfam}{$hash{$pfam}=$pf} else .....

so this is where i get lost. can i push a new value to the end? also, will this work in the first place? Im sorry. but i'm still new D: please help me? Thanks!


In reply to Making a hash with groups of IDs by jemswira

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.