in reply to Re^5: Can you write a faster code to perform this task?
in thread Can you write a faster code to perform this task?

> I tried to work this out but didn’t hit on trizen’s cleverness.

me too / neither =)

(tried /s but the returned count wasn't for groups)

> the /r flag to tr came in at 5.14. It won’t work on older Perls

If it's that fast using $str twice shouldn't be a big problem.

Should be mentioned that tr is destructive, i.e. a safety copy of the string may be needed too.

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

  • Comment on Re^6: Can you write a faster code to perform this task?