qr// should not be using the last-successful pattern, because it is
"(?^:)", not the empty pattern. A stringified qr// does not use the
last-successful pattern.
This was fixed for m/$qr/ (and =~ qr//) in commit
7e31363783, but
s/$qr// was left out.
=item *
An empty pattern created with C<qr//> used in C<m///> no longer triggers
-the "empty pattern reuses last pattern" behaviour. C<s///> has not yet
-been fixed. [perl #96230]
-
-XXX There is no reason s/// should not be fixed before 5.17.5. Nag sprout.
+the "empty pattern reuses last pattern" behaviour. [perl #96230]
=item *
position, once with zero-length,
second time with non-zero. */
- if (!RX_PRELEN(rx) && PL_curpm) {
+ if (!RX_PRELEN(rx) && PL_curpm
+ && !((struct regexp *)SvANY(rx))->mother_re) {
pm = PL_curpm;
rx = PM_GETRE(pm);
}
require './test.pl';
}
-plan(tests => 19);
+plan(tests => 20);
sub r {
return qr/Good/;
# [perl #96230] qr// should not have the reuse-last-pattern magic
"foo" =~ /foo/;
like "bar",qr//,'[perl #96230] =~ qr// does not reuse last successful pat';
+"foo" =~ /foo/;
+$_ = "bar";
+$_ =~ s/${qr||}/baz/;
+is $_, "bazbar", '[perl #96230] s/$qr// does not reuse last pat';