On Sep 5, Dan said: >cDNA AK027199 >cttaatgagt gagcagtaag tctgtgtaag aggctgaatg catgcccctc 50 >agataagcca gtacactcct tgcttagcaa cagaacatca gggtgatgtg 100 >[lots more like this] >tttatttgga aggttacctg ctgttggatt taataaattt gtttacttga 2100 >aaaaaaaaaa aaaaaaaa >Genomic chr16 <reverse strand>: >(my $cdna) = $mrnainfo=~ /cDNA\s+A(.*)\s+G/; >print $cdna; The . metacharacter doesn't match newlines. You need to use the /s modifier to a regex to get that to work. However, I'd approach this a bit differently. You know that you want to stop matching when you find an uppercase G, so use that to your advantage: my ($cdna) = $mrnainfo =~ /cDNA\s+A(.*\n[^G]*)/; The first part, /.*\n/, matches the label next to cDNA. The rest, [^G]*, matches zero or more non-G characters. That's much faster for what you want to do. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Use of uninitialized value in print after regexp
Jeff 'japhy/Marillion' Pinyan Wed, 05 Sep 2001 08:14:16 -0700
- Use of uninitialized value in print after re... Dan
- Jeff 'japhy/Marillion' Pinyan