Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Handling different sections in config files

by Nitrox (Chaplain)
on May 15, 2003 at 12:26 UTC ( [id://258365]=note: print w/replies, xml ) Need Help??


in reply to Handling different sections in config files

Another solution would be to "standardize" the config file so that each section followed the same format.
[Section2] user1=pass1:50 user2=pass2:51
Then simply use Config::IniFiles to tie the file to a hash:

tie my %ini, 'Config::IniFiles', ( -file => "MyConfig.ini" );
Then to retrieve the data from 'Section2':
foreach $user (keys %{$ini{'Section2'}}) { ($pass, $uid) = split /:/, $ini{'accounts'}{$user}; #do something with the values here }
-Nitrox

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-20 03:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found