Help for this page
my @vocabulary = qw(a abc abcd abd bc); my $sentence = 'abdaabc';
my $pattern = join '|', @vocabulary; $sentence =~ /^($pattern)+$/; ... my @list2; $sentence =~ /^(($pattern)(?{push @list2, $^N}))+$/; print (join ",", @list2), "\n"