use cfgfile1;

$file = shift @ARGV;
$cfg = new cfgfile1 $file;

@assoc = ('sect1', 'key1', 'sect1', 'key2', 'sect2', 'key1');

for ($count = 0; $count < $#assoc; $count += 2) {
    my($sec) = $assoc[$count];
    my($nam) = $assoc[$count+1];
    print ${sec}, "[$nam]=", $cfg->getProfileString($sec, $nam), "\n";
}

$s = $cfg->getProfileSection('sect1',1);
$e = $s->getEntry('key2', 1);
print $e->name(), "=", $e->getValue(), "\n";

$cfg->setProfileString('sect1', 'XXX', 'value');
$cfg->setProfileString('sect3', 'yyy', 'val2');

$cfg->write(*STDOUT);
