Hi Alan

This is the module I'd use for it:

https://metacpan.org/pod/Config::Tiny

The simplest approach would be to:

* read the destination config file (some_file.conf) into $Config_current
* read the config in-tray (param.txt) into $Config_new
* add the in-tray parameters to $Config_current

foreach my $key (keys($Config_new->{_}) {
   $Config_current->{_}->{$key} = $Config_new->{$key};
}

* write $Config_current back into some_file.conf

Hope that helps!

Andrew


On Tue, Dec 30, 2014 at 3:47 AM, Alan Glait <agl...@gmail.com> wrote:
> Hi !
> I have the Idea to make a perl script (better than in bash) to make some
> configuration on linux.
> I think to have some files like param.txt with some lines like:
> param_one = ZZZ XX CCCC VV
> param_two = ZZZZZZZZZ
> param_three = X
>
> so need to check if param_one is in some_file.conf and if it is there test
> the value .. if it is not .. add to some_file.conf ... I think it should be
> easy ... right ??
>
> Thanks for any help ..
>
> ;)



-- 
Andrew Solomon

Mentor@Geekuni http://geekuni.com/
http://www.linkedin.com/in/asolomon

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to