Ahh, I see, you're right, I missed something in the original code.
I think the original ($_ !~ /^#\s/ or $_ !~ /^\s/) was wrong in two ways:
- First: the 'or' should be an 'and'
- Second: I think the code should exclude domain-lines (#domain1) and empty lines.
So it should have been
$_ !~ /^#/ and $_ !~ /^\s/, which I had in mind and which can not be combined your way, but like
/^[#\s]/ or <code>/^#|\s/.