On ignoring comments: one way would be to bin them altogether. If $line contains your line from the hosts file, you could
$line =~ s/#.*//;
remove the hash and any character following it.
In reply to Re: parsing a terrible /etc/hosts
by hdb
in thread parsing a terrible /etc/hosts
by f77coder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |