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!