in reply to special characters in regexp

Does $a match the regex pattern in $b?

$a =~ /$b/

Does $a contain the string in $b?

$a =~ /\Q$b\E/ $a =~ /\Q$b/ # \E is optional my $b_re = quotemeta($b); # This is what \Q does $a =~ /$b_re/

Does $a equal the string in $b?

$a eq $b $a =~ /^\Q$b\E\z/ my $b_re = quotemeta($b); $a =~ /^$b_re\z/

quotemeta