My intention was to show the use of the 'r' modifier to resolve the problem. Because 'r' may have appeared to replace 'g', I commented on that also.
Not commenting on other aspects of the code should not be construed as tacit approval. I still don't know what output was expected; I don't know the context of this code; and there are other unknowns, such as how "scrooge" relates to the anything here.
There are in fact all sorts of issues with the code, ranging from poorly named variables (e.g. @list) to bad grammar (e.g. non-capitalised proper nouns).
I possibly would have used an easily identifiable placeholder such that the regex required no captures or lookaround assertions. The substitution may simply have been something like:
... s/__NEPHEW__/$nephew/r ...
Update: Did Donald Duck have a relative named Scrooge? Perhaps that explains the "scrooge" connection. Still just guessing. :-)
— Ken
In reply to Re^3: variables in substition/eval
by kcott
in thread variables in substition/eval
by xaphod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |