It is said that # should be backslashed or quoted with \Q..\E in perlre. So if # actually have higher precedence in regexp with /x modifier it is a bug, because it does not work as stated.
Second. If # had higher precedence than \Q..\E, string was just trimmed after the # character.