use strict; use warnings; use Data::Dumper; use Config::General; my $conf = Config::General->new( -ConfigFile => \*DATA ); my %config = $conf->getall; $_->{username} ||= 'Pascal2020' for $config{server1}, $config{server2}; print Dumper \%config; __DATA__ host = server1.domain.tld ssl = true port = 443 username = password = qwerty vhost = example host = server2.domain.tld ssl = false port = 2080 username = password = qwerty vhost = example