Something like this may work:

my $num = $description =~ tr/__/__/;

See "perldoc perlop" for the "tr" operator.

-Sharad

-----Original Message-----
From: Sara [mailto:[EMAIL PROTECTED]
Sent: Sunday, July 06, 2003 11:50 AM
To: [EMAIL PROTECTED]
Subject: Counting the characters..


There is a form field 'description' which is the input for CGI script.

$description = "This is my description and it contains numerous __ double underscore 
marks and __ these marks some special area in the field"

What I want to do is to count/extract the amount of times these double underscore 
marks are used. Like in the above example it should show that 2 marks are found.


$description =~ m/__/;

whats next???



Reply via email to