[perl #119095] Empty regular expression does not match in some cases

# New Ticket Created by Petr Pisar
# Please include the string: [perl #119095]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119095 >
Hello,
this code:
q{"} =~ m/"/;
if (q{a} =~ m//) {
print "TRUE\n";
} else {
print "FALSE\n";
}
should print TRUE, but it prints FALSE.
In other words, empty regular expression does not match. There is some side
effect because it depends on previous regular match (the first line). If
I change the first line anyhow, like m/"/ changing to m/./, the code starts
working correctly.
I observe this behaviour with somewhat patched 5.16.3, vanilla 5.18.0
and current blead.
You can use this one-liner instead:
$ perl -e 'q{"} =~ m/"/; if (q{a} =~ m//) { print qq{TRUE\n} }'
-- Petr