http://www.perlmonks.org?node_id=1060752


in reply to Replace a pattern in each file

The problem is that you're not doing the search correctly.

You wrote:

s#<--/--a8300-->.*?<--/a8300-->.##isg $_;
but the correct syntax is just
s#<--/--a8300-->.*?<--/a8300-->.##isg;
without the trailing ' $_' - the syntax of s/// is actually
$string=~s/from/to/opts;
with the $string being acted on defaulting to $_. Putting $_ after the expression makes no sense to perl...

Mike