Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Which is the better option?

by mrbbking (Hermit)
on May 18, 2002 at 13:13 UTC ( #167501=note: print w/replies, xml ) Need Help??

in reply to Which is the better option?

If you decide to go with a single flat file along the lines of the example you used, you might consider Config::IniFiles or Config::Simple. Both insulate you from the drudgery of parsing that sort of file by hand.

Your file format would have to change a little, but it would be quite similar:

[pupil1] maths=1_80:2_90 english=2_75:3_75 lastlogin=May 21 [pupil2] maths=1_68:2_87 english=2_75:3_75 lastlogin=May 12
Then, something like this:
use Config::IniFiles; my $cfg = new Config::IniFiles( -file => "/path/configfile.ini" ); my $pupil1_maths = $cfg->val( 'pupil1', 'maths' ); my @pupil1_maths = split /:/, $pupil1_maths;
might get you what you need.

But Config::IniFiles only reads the values - it does not offer a way to write/update them. I see that Config::Simple does have writing methods, so - if you go with this file format, you may want to take some time to look into that one.

I hope that helps you...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://167501]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2017-12-12 03:18 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (324 votes). Check out past polls.