Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Reading from an INI file

by mpolo (Chaplain)
on May 15, 2001 at 18:52 UTC ( [id://80547]=note: print w/replies, xml ) Need Help??


in reply to Reading from an INI file

Yes, a hash can accomplish this: In your file, you can leave off the $ signs, as they will be unnecessary. Then:
open FILE, "recorder.ini"||die "file open failed\n"; chomp(@lines=<FILE>); foreach(@lines) { ($key,$value)=split(/=/,$_); $hash{$key}=$value; }
Now where you would have used $NAME, you can use $hash{'NAME'}. (If I were you, I'd lowercase the key values to make typing easier.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-18 15:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found