in reply to Re: Is there another way to get named captures
in thread Is there another way to get named captures
is just %+ by another name° and wouldn't solve the OP's issue with it having global sideeffects, which could lead to unexpected results.
DB<34> 'ABCD' =~ /(?<a>\w)(?<b>\w)(?<c>\w)(?<d>\w)/; $h_matches = \% +{^CAPTURE}; say Dumper $h_matches $VAR1 = { 'b' => 'B', 'c' => 'C', 'a' => 'A', 'd' => 'D' }; DB<35> x $h_matches 0 HASH(0x2fa07f0) empty hash # oh oh ...
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) not an alias tho, they have different refs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Is there another way to get named captures
by Fletch (Bishop) on Jan 09, 2022 at 04:46 UTC | |
by AlexP (Pilgrim) on Jan 09, 2022 at 11:39 UTC |