A
Akim Demaille
Hi all,
The following does not work. This was expected, but since pre is
sometimes surprisingly powerful, I meant to make sure. The idea is to
handle with the s operator strings of x's preceded by their number
(and for instance to replace them with X). For instance "{2}xxx"
should give "XXx". So I tried this:
echo "{2}xxx" | perl -p -e 's/\{(\d+)\}x{\1}/"X" x $1/ge
Sure it does not work (I get the original string back). Yet, I would
have expected Perl to complain about my use of the backref as an
argument for the arity (this is 5.10.0). What the heck did it
understand?
Thanks in advance.
The following does not work. This was expected, but since pre is
sometimes surprisingly powerful, I meant to make sure. The idea is to
handle with the s operator strings of x's preceded by their number
(and for instance to replace them with X). For instance "{2}xxx"
should give "XXx". So I tried this:
echo "{2}xxx" | perl -p -e 's/\{(\d+)\}x{\1}/"X" x $1/ge
Sure it does not work (I get the original string back). Yet, I would
have expected Perl to complain about my use of the backref as an
argument for the arity (this is 5.10.0). What the heck did it
understand?
Thanks in advance.