my $string = 'IIIIIIIIIIIMMMMMMMMMMMMOOOOOOOOOOOOMMMMMMMMMIIIIIIIII'; my $count = () = $string =~ /M/g; print $count;
You can also use the tr operator.
my $count = $string =~ tr/M//;In reply to Re: Faster way to do this?
by fishmonger
in thread Faster way to do this?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |