The /e switch treats the replacement as an expression to be executed. This is not the same as evaluating the contents of $1..$n as executable code, i.e. treating the result of the interpolation as executable code, which needs "double eval" (/ee).
You could re-write
s/(10\+4)/$1/ee;
as
s/(10\+4)/eval $1/e;
In the case of s/(10\+4)/$1/e the replacement just resolves as the code line
"10+4";
which yields a string upon execution.
update: added single /e explanation--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re: /e in regexes
by shmem
in thread /e in regexes
by waldner
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |