in reply to A refactoring trap

You could also join the two expressions into one:
next PARSE if /^\s*(?:#|$)/;
That might be complex enough to refactor using /x.

Caution: Contents may have been coded under pressure.