in reply to Value of $_ inside a regex

Just to complete the above: (?{}) sets $_ to the LHS side also in the substitution part of s///e, even if the code is a no-op:

qwurx [shmem] ~> perl -le '$s = "foo"; $_="bar"; $s =~ s/./print/e' bar qwurx [shmem] ~> perl -le '$s = "foo"; $_="bar"; $s =~ s/.(?{print})/p +rint/e' foo foo qwurx [shmem] ~> perl -le '$s = "foo"; $_="bar"; $s =~ s/.(?{})/print/ +e' foo
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'