in reply to perldoc of s///ee wrong or just misleading?
| Substitution | Expression evaluated for each match | If the operator was implemented as a function |
|---|---|---|
| s/pat/repl/ | qq/repl/ | subst($_, qr/pat/, sub { qq/repl/ }) |
| s/pat/repl/e | repl | subst($_, qr/pat/, sub { repl }) |
| s/pat/repl/ee | eval(repl) | subst($_, qr/pat/, sub { eval(repl) }) |
In both of the last two cases, repl is evaluated as a scalar expression and its result is expected to be a string.
The docs are incorrect or confusing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perldoc of s///ee wrong or just misleading?
by LanX (Saint) on Dec 30, 2014 at 02:58 UTC | |
by ikegami (Patriarch) on Dec 31, 2014 at 17:41 UTC |