[Section1]
param1=value1
param2=value2
[Section2]
param1=value1
param2=value2
[Section3]
param1=value1
param2=value2
####
use Config::Simple;
$cfg = new Config::Simple(syntax => 'ini');
#
# Get Section Names
#
$cfg = Config::Simple->import_from('new.conf', \%Config) or die Config::Simple->error();
my @arr = ( keys %Config );
@arr1 = grep s/\..*//, @arr;
my %uniq;
@uniq{@arr} = ();
@sections = keys %uniq;
foreach my $secname (sort @sections)
{
print "section : $secname\n";
foreach (sort keys %Config)
{
print "$_ : $Config{$_}\n";
}
}
####
section : Section1
Section1.param1 : value1
Section1.param2 : value2
Section2.param1 : value1
Section2.param2 : value2
Section3.param1 : value1
Section3.param2 : value2
section : Section2
Section1.param1 : value1
Section1.param2 : value2
Section2.param1 : value1
Section2.param2 : value2
Section3.param1 : value1
Section3.param2 : value2
section : Section3
Section1.param1 : value1
Section1.param2 : value2
Section2.param1 : value1
Section2.param2 : value2
Section3.param1 : value1
Section3.param2 : value2
####
foreach my $secname (sort @sections)
{
print "section : $secname\n";
foreach (sort keys %Config)
{
$var = grep { !/\b[A-Za-z0-9.].*[.]/ } @arr;
if($secname == $var)
{
print "$secname\n";
}
else
{
print "false\n";
}
#compare 'secname' vs 'dialer onboard'.xxx
#print "$_ : $Config{$_}\n";
}
}
####
section : Section1
Section1.param1 : value1
Section1.param2 : value2
section : Section2
Section2.param1 : value1
Section2.param2 : value2
section : Section3
Section3.param1 : value1
Section3.param2 : value2