I've tried:
$count = () = s/\b$oldline\b/$spliced/eg for @array; …always gives "1".
$count = map { s/\b$oldline\b/$spliced/eg} @array; …always gives the full number of items in list @array.
…And I have tried numerous other options, probably not worth mentioning. Most simply give runtime errors. I've had no difficulty counting substitutions on individual line replacements, but I'm working on a large file and running this through a "foreach" loop just to have the checksums on replacement counts is going to cost me.
Having searched online, no one seems to address this--couldn't even find it at http://perldoc.perl.org/perlre.html
In reply to How to count substitutions on an array by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |