Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: How To Read Hosts File Into a Hash

by toolic (Bishop)
on Sep 16, 2011 at 01:17 UTC ( [id://926274]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://926274]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2025-11-15 02:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (72 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.