Are you sure this is the most efficient way to do this?
Yes, I am quite sure.
For multi-character substring counting avoid creating the huge list:
$s = 'ab'x 10e6;; ++$n while $s=~ m[ab]g;; print $n;; 10000000
In reply to Re^5: Out of Memory
by BrowserUk
in thread Out of Memory
by Michael Kittrell
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |