I have sample.ini file
Sample.ini
[Section1]
workers=3
port=8500
;
[Section2]
student=7
port=7688
;
How to read workers value from Section1 and update to workers=8
Expected result
[Section1] workers=8 ...
Thanks in Advance.
Try this Module. I think its exaclty what you want: Config::IniFiles
use Config::IniFiles;
$cfg = Config::IniFiles->new( -file => "Sample.ini" );
$value = $cfg->val( 'Section1', 'workers' );
$value = $value + 5;
$cfg->setval( "agent", "numworkers", $value );
$cfg->WriteConfig( 'agent.ini', -delta => 1 );