in reply to Permutation with repetitions

In my previous question in this thread I asked to count the number of occurrences of all permutations with repetitions. What if I only wanted to not have the count but a binary answer (i.e. 0 or 1) if a specific permutation is in my string? There must be a way to just change the regexp in a minor way.

Up until now I used the suggested solution of:
$n=4; $str="abababbcad"; %count; while($str =~ m[(?=([abcd]{$n})).]g){ ++$count{ $1}; }
I know I could set
$count{$1}=1
but this is not desirable since I would like to add to the hash the counts of unique occurrences of other strings. For example:
$str1="abad"; $str2="aaab"; $n=2;
should give the following list:
aa 1
ab 2
ad 1
ba 1
Thanks!