in reply to while =~ consecutive matching problem
while ($doesntCountAll =~ /\s$pattern\s/g) { $count++; pos($doesntCountAll) -= 1; } [download]