Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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...

Comment on Re: Which is the better option?
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2015-11-30 11:37 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (769 votes), past polls