in reply to Re^4: Out of Memory
in thread Out of Memory
Are you sure this is the most efficient way to do this?
Yes, I am quite sure.
- tr doesn't make copies, it operates in-place.
- It is optimised internally to recognise that when the source and replacements are identical, it is in 'counting mode' only.
For multi-character substring counting avoid creating the huge list:
$s = 'ab'x 10e6;; ++$n while $s=~ m[ab]g;; print $n;; 10000000
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom