in reply to Do a named regex group in 5.8?
The (?{}) and (??{}) constructs are available for use in perl5.8, but you'd have to ask yourself if such ugliness is really worth it:
$ perl -MData::Dumper -e 'q(abc de f abcdef) =~ m/(?<x>\w{3}).*\k<x>/ +and print Dumper {%+};' $ perl5.8.8 -MData::Dumper -e 'q(abc de f abcdef) =~ m/(?{$+{x} = pos} +)(\w{3})(?{$+{x} = substr($_, $+{x}, -$+{x}+pos)}).*(??{$+{x}})/ and +print Dumper {%+};'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Do a named regex group in 5.8?
by AnomalousMonk (Archbishop) on Feb 09, 2016 at 07:37 UTC |