my $t="ABCDABCDXBCDABCXABCDXXCDABXD"; $t =~ s/X/./g; my $u="ABCDABCDABCDABCDABCDABCDABCDABCDABCDABCD"; if ($u =~/$t/) { print "match found\n"; }