[ad_1]
When I use a named regex, I can print its contents:
my regex rgx ww ;
my $string = 'abcd';
$string ~~ / <rgx> /;
say $<rgx>; # 「ab」
But if I want to match with :g or :ex adverb, so there is more than one match, it doesn't work. The following
my regex rgx ww ;
my $string = 'abcd';
$string ~~ m:g/ <rgx> /;
say $<rgx>;
gives an error:
Type List does not support associative indexing.
in block <unit> at test1.p6 line 5
How should I modify my code?
[ad_2]
لینک منبع