> $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.

using somebody else's code (Ovid, a fellow perlmonk) as example:

#!/usr/bin/perl

use warnings;
use diagnostics;

use strict;

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

# the line below was borrowed from a perlmonk thread answer by Ovid
$count++ while $description =~ /(__)/gi;

print $count;

There you go... no hoops to jump through... and no missuse of tr/// or 
s///.

thanks
/oliver/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to