Greetings: I tried the following regular expression code, working generally from "Learning Perl 6" by brian d foy (Chapter 15). Everything works fine including the any() junction below, as long as the topic $_ variable isn't defined beforehand. However specifically in combination with a user-defined $_ topic variable, an any() junction returns the error, "Cannot modify an immutable Match." See Perl6 REPL code below (also checked with 6Pad (https://perl6.github.io/6pad/)) :
mbook:~ homedir$ perl6 To exit type 'exit' or '^D' > $_ = 'Hamadryas'; Hamadryas > my @genus = < Hamadryas Sostrata Junonia >; [Hamadryas Sostrata Junonia] > say $_.WHAT, $/.WHAT; (Str)Nil > if @genus ~~ m/Hama/ { put "Matches at least one"; }; Matches at least one > say $_.WHAT, $/.WHAT; (Str)(Match) > say m/Hama/; 「Hama」 > say m/Hama/; 「Hama」 > say $_.WHAT, $/.WHAT; (Str)(Match) > if any(@genus) ~~ m/Hama/ { put "Matches at least one again"; }; Matches at least one again > say $_.WHAT, $/.WHAT; (Str)(Junction) > say m/Hama/; Cannot modify an immutable Match (「Hama」) in block <unit> at <unknown file> line 1 > say $*VM moar (2019.07.1) > I understood from the "Learning Perl 6" book that the two smart-match lines of code are equivalent--the first one simply understands that there is an 'implied' any() junction to check the array against the match operator. But REPL reports back that in one case $/ returns a match object type, while in the other case [with an explicit any() junction], $/ returns a junction object type. So this feels inconsistent, at the very least. Any explanation appreciated. If after triaging this issue, someone would like me to open a Github issue, please point me towards the correct repository. Thanks, Bill. W. Michels, Ph.D.