http://www.perlmonks.org?node_id=770632


in reply to Re^2: conf file in Perl syntax
in thread conf file in Perl syntax

$ cat hosts.conf
<Hosts>
host_1 = 192.168.1.1
host_2 = 192.168.1.2
host_3 = 192.168.1.3
</Hosts>

$ cat hosts.pl

#!/usr/local/bin/perl -w
use Config::General(ParseConfig);
$configFile='hosts.conf';
my %config = ParseConfig($configFile);
foreach my $host (keys(%{$config{Hosts}}))
{
print "Machine : $host => $config{Hosts}{$host}\n";
}

$ ./hosts.pl
Machine : host_1 => 192.168.1.1
Machine : host_2 => 192.168.1.2
Machine : host_3 => 192.168.1.3