Subject: bug#997: perl-mode: Merging was not quite correct

From: [email-masked] (Harald Jörg)
Date: Tue, 17 Nov 2020 18:52:00 +0100

unmerge 997
reopen 997
thanks

So that's another attempt to exercise my super powers...

It turns out that 997, which had been merged with 26850, is actually a
different issue, and it is not fixed by the recent patch which
successfully dealt with Bug#26850 and Bug#26745 for Perl mode.
CPerl mode handles the examples correctly.

The issues are all related to each other because they all deal with the
difficulties to distinguish between a slash as a division sign and a
slash as a regex introduction.  The apostrophe "'" is a red herring - it
increases the visibility of the bug, but isn't the root cause.

Right now, Perl mode tries to detect regexes based on what's before
them.  Therefore, 26850 could be fixed by adding "return" to the stuff
which can occur before a regex.  However, the examples in this bug
demonstrate regexes with *nothing* before them: Regular expressions can
start a statement just fine, they have a return value and set some
variables as side effects.

Correctly detecting "nothing" in a regex needs some care.  So I'd like
to treat this as a separate bug which remains open for now.
-- 
Cheers,
haj