$ perl -Mstrict -Mwarnings -le ' > my @arr = qw{abc d.ef gh?i}; > my $patt; > { > local $" = q{|}; > $patt = qq{xyz(@{ [ map quotemeta, @arr ] })123}; > } > print $patt;' xyz(abc|d\.ef|gh\?i)123 $
You can also use this method with qr{...} which behaves like double quotes.
Cheers,
JohnGG
In reply to Re^2: RegExp to Search All Array Members?
by johngg
in thread RegExp to Search All Array Members?
by shoness
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |