See How can I count the number of occurrences of a substring within a string? from perlfaq4.
Martin
In reply to Re^3: count repeatation by marto in thread count repeatation by saranperl