in reply to Re: How to count substitutions on an array
in thread How to count substitutions on an array
Marshall,
Are you saying that a foreach loop would be just as fast as what Limbic-Region was suggesting for an array? Consider the following solution concept, which is what I had before, that I don't think is nearly so fast (though I didn't time it precisely).
foreach $replace (@substitutionlist) { ($oldline, $newline) = split(/\t/, $replace); $newline = s/\s/_SPACE_/g; #….more code here foreach $line (@array) { $count += s/\b$oldline\b/$spliced/eg for @array; #….more code here } } s/_SPACE_/ /g for @array;
Consider that @substitutionlist has over 10,000 lines, and @array has over 30,000, with many lines requiring multiple substitution replacements on a single line. Is the foreach setup outlined above really just as efficient?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to count substitutions on an array
by AnomalousMonk (Archbishop) on Aug 13, 2016 at 14:29 UTC | |
|
Re^3: How to count substitutions on an array
by AnomalousMonk (Archbishop) on Aug 13, 2016 at 18:23 UTC | |
by Anonymous Monk on Aug 13, 2016 at 19:11 UTC | |
|
Re^3: How to count substitutions on an array
by Marshall (Canon) on Aug 14, 2016 at 14:55 UTC |