For the metacharacters case, how about this:
my $re = do { local $" = '\E|\Q'; qr/\Q@array\E/; };
That lets you ditch the map and array refernceing/dereferencing inside the regex. Though it is arguably not as clear.
----
send money to your kernel via the boot loader.. This and more wisdom available from Markov Hardburn.
In reply to Re^2: matching elements in a list in a logical OR fashion
by hardburn
in thread matching elements in a list in a logical OR fashion
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |