|Welcome to the Monastery|
How can I count characters between two same substrings in a string where the substring is repeated more than 5 times?by supriyoch_2008 (Monk)
|on Dec 09, 2011 at 07:42 UTC||Need Help??|
supriyoch_2008 has asked for the
wisdom of the Perl Monks concerning the following question:
I am a beginner in PERL programming. I shall appreciate if you can help me to solve a basic problem in PERL programming.
I need the PERL program to count the number of characters between any two substrings in a long string and the same substring is repeated several times in the string. For example, the substring "cat" is repeated 5 times in the string $a="batcatratdeercatdogmousepalmcocoacatdoll monkeycatsusandollypollycatpomkelly". I need a perl program to count the number of characters between 1st and 2nd "cat", between 2nd and 3rd "cat" and so on.
I am a beginner in perl. I tried a lot to find such a program to count the characters between two same substrings in a string through internet but could not find. If anyone has the solution, please write to me in the email: firstname.lastname@example.org.
Please suggest me which topics in perl would help me solve these problems.
I am looking forward to hear from you soon.