By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,903 Members | 1,081 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,903 IT Pros & Developers. It's quick & easy.

reading whole section of INI file

P: 72
Is there any module that could read the whole section of INI file?

Example INI file:

whenever i read the [A] i could get all the parameter as well as value inside the section. e.g.

Jul 7 '08 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 2.5K+
P: 3,503
Did you happen to search CPAN and see if any of the modules did what you want? That is the first place we would look and it should be that way for you as well.

You could use a module, or you could set up a test of each line and have a variable (lets say $chunk) equal to the section name (ie: [A]) If the next line matches [?], then its a new section, if not, you can feed the next line into an array with the section name (A) or whatever you wanted to call it.

Either way, its up to you, just providing you another way that you could do it.

You could also have a test to check for lines beginning with a # and to ignore them.


Jul 7 '08 #2

Expert 2.5K+
P: 4,059
Many module son CPAN. One written by a perl bud of mine:


Search Config::Ini and you will find many more.
Jul 7 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.