Please put at least some effort into it!
Hint: Read the (key,value) pairs from the file into a hash. Make the changes and write it back to the file. The following snippet from the Perl cookbook, I used many times to read config files into a hash.
while (<CONFIG>) {
chomp; # no newline
s/#.*//; # no comments
s/^\s+//; # no leading white
s/\s+$//; # no trailing white
next unless length; # anything left?
my ($var, $value) = split(/\s*=\s*/, $_, 2);
$User_Preferences{$var} = $value;
}
Cheers
Harry
Update
Misunderstood what you want. Take a look at Term::ReadKey.
|