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

Why do I get the "uninitialized error" for $key?
My guess is your input file has a blank line:
while (<FILE>) { next if /^\s*#/ ; # skip comments next unless /\S/; # skip blank lines chomp; my ($key, $value) = split; $hosts{$key} = $value; }
See perlre