in reply to Re: Config file to tree format with id, parent, key, value
in thread Config file to tree format with id, parent, key, value

Thanks for your answer. I don't want the comments, I actually want to get rid of them. I tested with Config::General and is interesting, but the problem is that when I have the sub-structures, the lib just put everything together and I can't split or find the parents of each key-value... That's my test-code:
#!/usr/bin/perl use warnings; use strict; use Config::General; my $conf = Config::General->new("fh.cfg"); my %config = $conf->getall; my @myarray = (); while( my( $key, $value ) = each %config ){ print "$key: $value\n"; if (ref($value) eq 'ARRAY'){ @myarray = @$value; foreach (@myarray) { print "$_\n"; } } }
And here is the output repeated (because "request_snapshot" appears many times in my config):
(...) status_interval: 30; exchange_is_active_time_end: "16:00"; dropout_detection_initial_interval_secs: 600; request_snapshot: ARRAY(0xce97a8) false; false; false; false; (...)