Your problem is that the march for
w\\(
is
w(
which is not in your array. The match is different from the RegEx.
Another bug:
d.
and
b.
are not matching "d" or "b" followed by a point, they match "d" or "b" followed by anything, a letter, a number, a space ...
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[
^]