in reply to better way to get last named capture group
> Internally %+ and %- are implemented with a real tied interface via Tie::Hash::NamedCapture
In a hurry I couldn't find the implementation, not sure if it was done in pure Perl or XS/C.
But even if in C, monkey patching STORE with a wrapper should do the job
Never mind.
I ran some experiments and couldn't succeed in patching STORE to any effect.
And according to the docs
> %- and %+ are tied views into a common internal hash associated with the last successful regular expression.
this wouldn't help either, because the internal hash is out of reach ... too bad.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: better way to get last named capture group
by ysth (Canon) on Jul 03, 2025 at 02:25 UTC | |
by LanX (Saint) on Jul 04, 2025 at 10:53 UTC | |
|
Re^2: better way to get last named capture group
by ikegami (Patriarch) on Jul 03, 2025 at 10:56 UTC |