$x = ${qr//};
$x = 3;
On the second line, we don’t need to copy the stringification of the
regexp, since we are just going to clobber it anyway.
/* Remember that SvPVX is in the head, not the body. */
assert(!SvLEN(sv));
/* Their buffer is already owned by someone else. */
- SvPVX(sv) = savepvn(SvPVX(sv), SvCUR(sv));
- SvLEN_set(temp, SvCUR(sv)+1);
+ if (flags & SV_COW_DROP_PV) SvPOK_off(sv);
+ else {
+ SvPVX(sv) = savepvn(SvPVX(sv), SvCUR(sv));
+ SvLEN_set(temp, SvCUR(sv)+1);
+ }
/* Now swap the rest of the bodies. */