use Interpolation OR => sub { join '|', map "\Q$_", sort @{$_[0]} }; # and later... my $goodnames = qr/$OR{\@names}/;