sundeep has asked for the wisdom of the Perl Monks concerning the following question:
This is the source file content
LOCUS YP_001648463 258 aa linear INV 17 +-JUN-2009 DEFINITION cytochrome c oxidase subunit II [Ephydatia muelleri]. ACCESSION YP_001648463 VERSION YP_001648463.1 GI:164420795 DBLINK Project: 28177 DBSOURCE REFSEQ: accession NC_010202.1 KEYWORDS . SOURCE mitochondrion Ephydatia muelleri ORGANISM Ephydatia muelleri Eukaryota; Metazoa; Porifera; Demospongiae; Ceractinomorph +a; Haplosclerida; Spongillidae; Ephydatia. REFERENCE 1 (residues 1 to 258) AUTHORS Lavrov,D.V., Wang,X. and Kelly,M. TITLE Reconstructing ordinal relationships in the Demospongiae u +sing mitochondrial genomic data
This is the program , i have written
use strict; use warnings; open (PROTEIN,"<invertebrate.protein.gpff") or die $! ; my @prot=<PROTEIN>; my $protlen=$#prot; my $version="VERSION"; my $dbsource="DBSOURCE"; my $protname; my $rna; for(my $i=0;$i<=$protlen;$i++) { if((substr($prot[$i],0,7)) eq $version) { # have to store the value of "YP_001648463.1" in $protname } if((substr($prot[$i],0,8)) eq $dbsource) { # have to store the value of "NC_010202.1" in $rna } } close PROTEIN;
My required strings are mentioned in the commented lines of the IF statement.Can someone tell me, how to extract this data and store in those respective scalars
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extract the matching strings
by moritz (Cardinal) on Nov 11, 2010 at 22:17 UTC | |
|
Re: Extract the matching strings
by oko1 (Deacon) on Nov 11, 2010 at 22:33 UTC | |
|
Re: Extract the matching strings
by poulhs (Beadle) on Nov 11, 2010 at 23:18 UTC | |
|
Re: Extract the matching strings
by Marshall (Canon) on Nov 12, 2010 at 08:50 UTC | |
|
Re: Extract the matching strings
by aquarium (Curate) on Nov 12, 2010 at 04:16 UTC |