in reply to How to count substitutions on an array

Your first guess was close, but you need scalar context. I chose to let $spliced "double" the matched string. (It did require /ee to accomplish this.
use strict; use warnings; my $oldline = qr/xyzzy/; my $spliced = q/"$1$1"/; my @array = ( 'xyzzy blah xyzzy moreBLah xyzzy asdfouyXYZZY', 'blah xyzzy', ); my $count; $count += s/\b($oldline)\b/$spliced/gee for @array; $" = "\n"; print "@array\n\n";
OUTPUT:
xyzzyxyzzy blah xyzzyxyzzy moreBLah xyzzyxyzzy asdfouyXYZZY blah xyzzyxyzzy 4
Bill