Transitions are not intended to be interpolated into regular expressions. They are intended for use in regular Perl 6 expressions, especially with comparison operators (e.g. eq ):
my @a = <xy z>; say "y" eq any(@a);
To match any of the array values in the regular expression, simply write the name of the array variable (starting with @ ) in the regular expression. By default, this is interpreted as interleaving | ("the longest match"), but you can also indicate that it is an alternation || ("first match"):
my @a = <foo bar barkeep>; say "barkeeper" ~~ / @a /;
source share