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
In reply to Re: Value of $_ inside a regex
by shmem
in thread Value of $_ inside a regex
by Athanasius
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |