in reply to Re: build regexp on a list of patterns
in thread build regexp on a list of patterns

my $re = do { local $" = '|'; qr/^@{[map {quotemeta} @list]}$/; };
In this case, it would appear that they are all the same length, but in general, the list should be sorted longest-first, so that @list=qw/foo bar foobar/ will ever match foobar.