in reply to Re^2: Regex error when [] occurs in file..
in thread Regex error when [] occurs in file..
Are all 'special variables' ($&, $N (N is integer)) expanded in that way too?All variables are expanded that way, special or not:
See also quotemeta and the \Q and \E escape sequences.my $var = '[ab]'; my $string = '12a3434'; print "match" if $string =~ /$var/;
In Section
Seekers of Perl Wisdom