in reply to pattern matching with substring containing special character

Try using a regex, by replacing your 'X' with '.', you can easily check if they match, something like (untested):

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

...roboticus

When your only tool is a hammer, all problems look like your thumb.