in reply to my program will run on my computer but not in CGI

To ensure it is not a wrong data handling trouble (its likely to be a write privileges problem), what about using XML for config files? For the config file, you can try something like:

<opt>
  <section1>
   <param1>foo</param1>
   <param2>bar</param2>
  </section1>
  <section2>
   <other>foobar</other>
  </section2>
</opt>

And then, use something like this to read, modify and update your config file:

use strict; use XML::Simple; my $config = "fooconf.xml"; my $xml = XMLin($config) or die "Error reading config: $!"; $xml->{section1}{param1} = "replacement1"; $xml->{section2}{other} = "replacement2"; open CONF, ">$config" or die "Error writing config: $!"; print CONF XMLout($xml, NoAttr => 1); close CONF;