Re: [Boston.pm] count substrings within strings

2005-08-10 Thread Tom Metro
Stephen A. Jarjoura wrote: I needed to count the number of occurances of a substring within a string... $buffer =~ s/(\transfer)/$transfer_count++;$1/sg; Don't you need a /e modifier for that to work? Did I miss some obvious, and easier method? my @count = $string =~ m/$substr/g;

Re: [Boston.pm] count substrings within strings

2005-08-09 Thread Ben Tilly
On 8/9/05, Ronald J Kimball [EMAIL PROTECTED] wrote: On Tue, Aug 09, 2005 at 09:07:16PM -0700, Stephen A. Jarjoura wrote: [...] Did I miss some obvious, and easier method? Basically, you need a loop. s///g allows you to hide the loop, but is less efficient because you're updating the