http://qs1969.pair.com?node_id=671672


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:
my $var = '[ab]'; my $string = '12a3434'; print "match" if $string =~ /$var/;
See also quotemeta and the \Q and \E escape sequences.