A stringy regex appearing in a match is treated as between double quotes. That makes perl attempt to interpolate both "@" and "$" followed by legal variable names.
Interpolation is done before the regex is compiled. Since an array being interpolated is joined by the value of the $" variable, I like to use a local value of $" to construct big alternations:
my $alt_foo_re = do { local $" = '|'; qr/@foo/; }; # same as: # my $alt_foo_re = do { # my $alt_foo = join '|', @foo; # qr/$alt_foo/; # }
After Compline,
Zaxo
In reply to Re: Backslashed "@" in reg exes
by Zaxo
in thread Backslashed "@" in reg exes
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |