Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: finding sequence

by haukex (Archbishop)
on Jun 22, 2018 at 19:40 UTC ( [id://1217251]=note: print w/replies, xml ) Need Help??


in reply to finding sequence

If I fix your regular expression (see perlretut), then note that $tmp1[0] =~ /\Q$tmp2[0]\E/ means "is the string $tmp2[0] contained in $tmp1[0]?". However, just as an example, $tmp1[0] may be "ATCCCACCGCTGCCACCA", while $tmp2[0] may be "AACCCCATCCCACCGCTGCCACCA" - so as you might be able to tell, you've got your condition reversed. Some better variable naming would really help here!

You haven't shown your expected output, so I can't give any advice there other than to have a look at How do I post a question effectively?, SSCCE, and I know what I mean. Why don't you?

A few general tips: Use strict and warnings (you've been told this twice before), and use the newer, three-argument form of open and lexical filehandles, as in open(my $infh1, '<', $filename) or die "Cannot open $filename: $!";

Update: By the way, you could build a single regex out of all of the search strings - I wrote a tutorial on this at Building Regex Alternations Dynamically.

Replies are listed 'Best First'.
Re^2: finding sequence
by yueli711 (Sexton) on Jun 22, 2018 at 20:19 UTC

    It really solve my problem! Thanks!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-24 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found