s/$1//g will not automatically escape the regex meta characters like * or (in your case) ?. See \Q..\E and/or quotemeta.
Most likely, you want:
$file =~ s/\Q$1\E//g;
In reply to Re: s/// don't delete matching phrase
by Corion
in thread s/// don't delete matching phrase
by ChevLucas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |