On Sun, Jul 22, 2007 at 07:15:50AM -0000, [EMAIL PROTECTED] wrote:
> Mark Perkel wrote:
> If I have a string, what's that fastest way to count the number of 
> periods in the string?
> 
> in perl, I would probably split the string at the periods
> 
> @parts = split /\./, $string;
> and then just use the number of splits
> $#parts

I believe the official/fastest/shortest method is:

$count = $string =~ y/.//;

-- 
Randomly Selected Tagline:
If a can of Alpo costs 38 cents, would it cost $2.50 in Dog Dollars?

Attachment: pgpK1hqYi3jEL.pgp
Description: PGP signature

Reply via email to