On Fri, 15 Feb 2019 11:37:16 -0800, corion@corion.net wrote: > last week I (together with E. Choroba) stumbled on a weird syntax > error (Windows shell quoting): > > perl -wle "s/(.*)/print $fh $1/e" > > This surprisingly gives a syntax error, yet still seems to run the > code: > > Scalar found where operator expected at -e line 1, near "$fh $1" > (Missing operator before $1?) This isn't a syntax error, but a warning (but still buggy). The code inside the replacement part of s///e is handled with a sublex, and the code that decides whether an operator or term is expected after C<print $fh> is mostly skipped for a sublex. The attached fixes that, doing the same checks for C<print $fh> in a sublex within brackets as for a normal parse. This fixes the same problem for C<< "... ${code} ..." >>. Tony --- via perlbug: queue: perl5 status: new https://rt.perl.org/Ticket/Display.html?id=133850Thread Previous