ysth has asked for the wisdom of the Perl Monks concerning the following question:
In perl, if there is a single variable equivalent to lastgroup, I can't find it, the closest I see is %+:$ python -c 'import regex; print(regex.sub("^(?<a>.)|(?<c>.)$|(?<b>.)" +, lambda m:m.lastgroup, "xxx"))' abc
which isn't awful, but is there a better way I'm missing?$ perl -E'say "xxx" =~ s/^(?<a>.)|(?<c>.)$|(?<b>.)/@{[keys %+]}/gr' abc
|
---|