Re: A subroutine to find every occurrence of a substring in a string?

2010-06-10 Thread C.DeRykus
On Jun 10, 2:07 am, chas.ow...@gmail.com ("Chas. Owens") wrote: > On Thu, Jun 10, 2010 at 00:59, C.DeRykus wrote: > > snip> Not that I know of but you write your own subroutine > > using the index code you've shown. Nearly trivial to > > do and, after all, plagiarism is a virtue :) > > snip > > I

Re: system vs. backticks

2010-06-10 Thread pauldkline
The solution is to open a shell script with a pipe and send it the commands to be executed. That way no new shell is opened for each command and McAfee is quiet: # open shell with pipe and turn off buffering open (OPSH, "|-") or exec ("./my.sh 01 >opsh1.log 2>&1"); $savefh

Re: A subroutine to find every occurrence of a substring in a string?

2010-06-10 Thread Chas. Owens
On Thu, Jun 10, 2010 at 10:26, Rob Dixon wrote: snip > It is possible that index() is faster than regular expressions, but I would > write the code below. snip It looks like, at least on Perl 5.12.0, iterated_regex is faster than index for finding non-overlaping substrings when the substring is s

Re: A subroutine to find every occurrence of a substring in a string?

2010-06-10 Thread Rob Dixon
On 10/06/2010 03:17, Peng Yu wrote: I can't find an existing perl subroutine (in the library) to find every occurrence of a substring in a string. The following webpage "Example 3b. How to find every occurrence" uses a loop to do so. But I'd prefer a subroutine. Could you let me know if such a su

Re: A subroutine to find every occurrence of a substring in a string?

2010-06-10 Thread Steve Bertrand
On 2010.06.10 05:07, Chas. Owens wrote: > On Thu, Jun 10, 2010 at 00:59, C.DeRykus wrote: > snip >> Not that I know of but you write your own subroutine >> using the index code you've shown. Nearly trivial to >> do and, after all, plagiarism is a virtue :) > snip > > I know that this was meant as

Re: A subroutine to find every occurrence of a substring in a string?

2010-06-10 Thread Chas. Owens
On Thu, Jun 10, 2010 at 00:59, C.DeRykus wrote: snip > Not that I know of but you write your own subroutine > using the index code you've shown. Nearly trivial to > do and, after all, plagiarism is a virtue :) snip I know that this was meant as a joke, but plagiarism is not a virtue in the Perl c

Re: A subroutine to find every occurrence of a substring in a string?

2010-06-10 Thread C.DeRykus
On Jun 9, 7:17 pm, pengyu...@gmail.com (Peng Yu) wrote: > I can't find an existing perl subroutine (in the library) to find > every occurrence of a substring in a string. The following webpage > "Example 3b. How to find every occurrence" uses a loop to do so. But > I'd prefer a subroutine. Could yo

Re: A subroutine to find every occurrence of a substring in a string?

2010-06-10 Thread Chas. Owens
On Wed, Jun 9, 2010 at 22:17, Peng Yu wrote: > I can't find an existing perl subroutine (in the library) to find > every occurrence of a substring in a string. The following webpage > "Example 3b. How to find every occurrence" uses a loop to do so. But > I'd prefer a subroutine. Could you let me k