Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: conf file in Perl syntax

by Anonymous Monk
on Jun 11, 2009 at 12:34 UTC ( #770632=note: print w/ replies, xml ) Need Help??


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


Comment on Re^3: conf file in Perl syntax

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://770632]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2014-12-28 17:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls