use Config::IniFiles; use strict; updtDescrip(); sub updtDescrip() { my $tmpPthFil = q(test.ini); #Create ini file with one dummy section if 1)it does not exist or 2)exists but zero size if (not -e $tmpPthFil or ( (-e $tmpPthFil) and (-z $tmpPthFil) ) ) { open INI, ">$tmpPthFil"; print INI "[Ini]"; close INI; } #Now the -file option is working ok. my $tmpIni = new Config::IniFiles( -file => $tmpPthFil, -allowedcommentchars => '*', -nocase => '1', ); #Output sections that already exist in ini file. foreach ($tmpIni->Sections) { print "Section:$_\n"; } #Add a new section and parameter with a value $tmpIni->newval('apps', 'app1', 'bull.exe', ); $tmpIni->newval('apps', 'app2', 'bull2.exe', ); #Set already existing parameter value in a section $tmpIni->setval ('apps', 'app1', 'app99.exe'); #Retrives existing parameter value in a section my $app = $tmpIni->val ('apps', 'app1'); print "\nApp1 is $app"; #Save config file $tmpIni->WriteConfig ($tmpPthFil); } config file after run: [ini] [apps] app1=app99.exe app2=bull2.exe