I am trying to find a simple way to match any of a group of words. I have been using a for loop, but is there a simpler way?
my @a=<a b c d e f>;
my $x="a1234567";
say $x ~~ m/ @a.any /;
It returns False. Is there a way to make it work? Thanks.
my @a = <a b c d e f>;
my $x = "a1234567";
say $x ~~ /@a/;
/@a/
is the same as /| @a/
which is longest alternation. For alternation you can use /|| @a/
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With