Why do I get the "uninitialized error" for $key?My guess is your input file has a blank line:
See perlrewhile (<FILE>) { next if /^\s*#/ ; # skip comments next unless /\S/; # skip blank lines chomp; my ($key, $value) = split; $hosts{$key} = $value; }
In reply to Re^3: How To Read Hosts File Into a Hash
by toolic
in thread How To Read Hosts File Into a Hash
by at2marty
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |