Huh. Seems the docs would say the opposite save_file() Writes the config hash back to the hard disk. This method takes one or two parameters. The first parameter must be the filename where the config should be written to. The second parameter is optional, it must be a reference to a hash structure, if you set it. If you do not supply this second parameter then the internal config hash, which has already been parsed, will be used.
Please note that any occurrence of comments will be ignored by getall() and thus be lost after you call this method. You need also to know that named blocks will be converted to nested blocks (which is the same from the perl point of view). An example: <user hans> id 13 </user> will become the following after saving: <user> <hans> id 13 </hans> </user> On Wed, Feb 26, 2020 at 2:28 PM Frans Spiesschaert < frans.spiesscha...@yucom.be> wrote: > Hi, > > This is my exmple.pl > > #!/usr/bin/perl -w > > use strict; > use Config::General; > > my $datafilename = 'example.conf'; > my %confighash; > my $config = \%confighash; > $config->{client}->{Bob}->{city} = 'Brussels'; > $config->{client}->{Jane}->{city} = 'Antwerp'; > > my $datafile = Config::General->new; > $datafile->save_file($datafilename, $config); > > > and that gives as expected the following result: > > <client> > <Jane> > city Antwerp > </Jane> > <Bob> > city Brussels > </Bob> > </client> > > > but when I comment out in that file the line: > # $config->{client}->{Jane}->{city} = 'Antwerp'; > > I get the following result: > > <client Bob> > city Brussels > </client> > > But also in such a case I want to get > > <client> > <Bob> > city Brussels > </Bob> > </client> > > Is there a way to get this result in such a case? > > > -- > Kind regards, > Frans Spiesschaert > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > > -- a Andy Bach, afb...@gmail.com 608 658-1890 cell 608 261-5738 wk