in reply to Re^3: Can you write a faster code to perform this task?
in thread Can you write a faster code to perform this task?
I tried it with replacing 'M' with 'M' and it worked. No need to worry about exotic characters.
use 5.014; say 'iiiiiiiiMMMMMMMMMMMooooooooooooMMMMMMMMMMiiiiiMMMMMMMMoooo' =~ tr/M/M/sr=~tr/M//; # => prints: 3
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Can you write a faster code to perform this task?
by BrowserUk (Patriarch) on Sep 29, 2014 at 19:38 UTC |