On 04/26/00, ""Justin Rogers" <[EMAIL PROTECTED]>" wrote:
> What is the easiest way to get a count of a certain character in a string.
> For instance if I wanted to count periods in an FAQ line like:
>
> 1.4.6.3
RTM
perldoc -q count
$_ = "1.4.6.3";
$cnt = tr/.//;
HTH,
Douglas Wilson
---
You a
Justin Rogers wrote:
>
> What is the easiest way to get a count of a certain character in a string.
> For instance if I wanted to count periods in an FAQ line like:
>
> 1.4.6.3
>
> The item you are reading is nested 3 levels deep. How do I get the count.
$count = $string =~ tr/././;
What is the easiest way to get a count of a certain character in a string.
For instance if I wanted to count periods in an FAQ line like:
1.4.6.3
The item you are reading is nested 3 levels deep. How do I get the count.
$count = $faqline =~ s/\./\./;
does that work? Or is:
$_ = $faqline;
$c