in reply to Re^2: How To Read Hosts File Into a Hash
in thread How To Read Hosts File Into a Hash

Your /etc/hosts file lines 3 and 11 have zero or more white space characters and nothing else. You should skip those:

while (<FILE>) { next if /\A\s*\z/ ; # skip blank lines next if /^\s*#/ ; # skip comments

Or combine the regexes:

next if /\A\s*(?:#|\z)/ ; skip comments and blank lines