perl6 匹配一组单词的最佳方法是什么?

perl6 What is the best way to match any of a group of words?

我正在尝试找到一种简单的方法来匹配一组单词中的任何一个。我一直在使用for循环,但有没有更简单的方法?

my @a=<a b c d e f>;
my $x="a1234567";
say $x ~~ m/ @a.any /;

它returns 错误。有没有办法让它工作?谢谢

my @a = <a b c d e f>;
my $x = "a1234567";
say $x ~~ /@a/;

/@a//| @a/ 相同,是最长的交替。对于交替,您可以使用 /|| @a/.