467,104 Members | 1,055 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,104 developers. It's quick & easy.

reading whole section of INI file

Hi,
Is there any module that could read the whole section of INI file?

Example INI file:
[A]
AA=1
AB=2
[b]
BA=2
BC=3

whenever i read the [A] i could get all the parameter as well as value inside the section. e.g.
AA=1
AB=2

Thanks.
Jul 7 '08 #1
  • viewed: 2038
Share:
2 Replies
numberwhun
Expert Mod 2GB
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.

Regards,

Jeff
Jul 7 '08 #2
KevinADC
Expert 2GB
Many module son CPAN. One written by a perl bud of mine:

Config-INI-Simple

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.

Similar topics

1 post views Thread by fabrice | last post: by
6 posts views Thread by Foxy Kav | last post: by
7 posts views Thread by Shane | last post: by
50 posts views Thread by Michael Mair | last post: by
3 posts views Thread by Nijazi Halimaji | last post: by
14 posts views Thread by noridotjabi@gmail.com | last post: by
4 posts views Thread by Phoe6 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.