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;
|
|---|