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

No need for a new perl and the /r option either. This works fine:

#! perl -slw use strict; use Time::HiRes qw[ time ]; my $start = time; my $count=0; while( <DATA> ) { # $count += ()= m{M+}g; tr/M/M/s; $count += tr/M/M/; } print $count."\n"; printf "Took %9f secs\n", time() - $start;

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.