On Tue, Jun 29, 2021 at 4:31 PM Nicholas Clark <nick@ccl4.org> wrote: > So I guess, the question is: > > If the PV stored for a regex has an *unescaped* dollar sign in it it *has* > to have originated from a regex written with '' ? > I'm not sure I follow you all the way, but I don't think so. It could come from an interpolated variable: eirik@rustybox[17:33:04]~$ perl 2>&1 | grep PV use Devel::Peek; Dump($_) for qr'$foo', qr/${\q($)}foo/; __END__ PV = 0x55d52be518a0 "(?^:$foo)" PV = 0x55d52be518a0 "(?^:$foo)" PV = 0x55d52be714c0 "(?^:$foo)" PV = 0x55d52be714c0 "(?^:$foo)" eirik@rustybox[17:33:24]~$ > 1) the *only* way that could have got there was by being written as qr'' > If I read you right, no, not quite. > 2) the *only* way to convert that back to a regex is to output qr'' > (ie there exists no escaping syntax capable of recreating it inside > qr//) > The only *other* way I know of, is through a variable. Perhaps Data::Dumper should output qr/(?^:${\q($)}foo)/;instead? EirikThread Previous | Thread Next