$s = 'ab'x 10e6;; ++$n while $s=~ m[ab]g;; print $n;; 10000000