Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Taking things one step further:

use feature ":5.14"; use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump pp); my @d = split /\n/, <<'END'; O59734 | Name=smf1; ORFNames=SPBC3E7.14, SPBC4F6.01 Q97W02 | Name=dbh; Synonyms=dpo4; OrderedLocusNames=SSO2448 B0JTM2 | Name=trpC; OrderedLocusNames=MAE_45030 Q0WVE9; Q5XF02; Q9ZVN7 | OrderedLocusNames=At1g05030; ORFNames=T7A14.1 +0 Q15X31 | Name=rraB; OrderedLocusNames=Patl_1031 Q66640 | Name=36 Q9F2S0 | Name=hemL; OrderedLocusNames=SCO4469; ORFNames=SCD65.12 A9R5H1 | Name=dctA; OrderedLocusNames=YpAngola_A4067 Q7N3W0 | Name=rnt; OrderedLocusNames=plu2603 Q6GNW0 | Name=lrrfip2 Q4L4T4 | OrderedLocusNames=SH2032 B7I359 | Name=rplL; OrderedLocusNames=AB57_0368 B2HII2 | Name=leuD; OrderedLocusNames=MMAR_1727 END my $D; for(@d) {my ($c, $d) = split /\s+\|\s+/; for(split /;\s+/, $d) {my ($k, $v) = split /=/; $D->{$_}{$k} = $v for split /;\s+/, $c; } } say $D->{Q9ZVN7}{ORFNames}; say $D->{B2HII2}{Name};

Produces

T7A14.10 leuD

In reply to Re^2: Extraction help. by philiprbrenan
in thread Extraction help. by invaderzard

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!
  • 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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (15)
    As of 2015-07-29 15:50 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (265 votes), past polls