On Jul 23, 2004, at 11:42 AM, Jaffer Shaik wrote:

$str = "abckdweqadidkaaaaisdikda";

In the above string, I want to count the occurrences of character 'a',
i.e I should get count of a = 7.

How can i achieve this in Perl.


@a=$str=~m/a/g; print scalar(@a)."\n";

Remo


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to