in reply to Regular expression match trouble with "+"

You need \Q...\E which quotes metacharacters in regexes.

if ($a =~ m/\Q$b\E/)

See also quotemeta

By the way, $a and $b have a special meaning to Perl (because of their use in sorting) so it's a really bad idea to use them for anything else.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.