I assumed from the example strings given that the positions of the characters within the strings was important. That is, "ABCXXXXXX" would be a good match, but "XABCXXXXX" would not.
If position is not important then my solution doesn't work at all. If my assumption was correct however, then using Algorithm::Diff::LCSidx to compare the pattern against the target string will work, but requires the additional step of checking to see if the contents of the two arrays of indices pointed to by the returned references are equivalent. Unless I missed something when skimming through the documentation that is.
Thanks, tye. Hanging out around here I definitely learn something new (usually several somethings) every day.