Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Extraction help.

by philiprbrenan (Monk)
on Sep 02, 2012 at 21:05 UTC ( #991330=note: print w/ replies, xml ) Need Help??


in reply to Re: Extraction help.
in thread Extraction 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


Comment on Re^2: Extraction help.
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991330]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2015-07-29 06:26 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 (260 votes), past polls