How to find all the strings in a long that are at most of n different characters of a test string?

Hi, Suppose I have a long string $a, and a test string $b. I want to fine all the substrings in $a, whose length is the same as $b with at most n mismatches. For example, string 'abcdef' and string 'aacdxf' have two mismatches at the 2nd character and the 5th character. I'm wondering if this can be done easily in perl. Can I use regular