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
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
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|