in reply to s/// don't delete matching phrase
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; [download]