use strict; use warnings; use JSON; use Data::Dumper; # Get a JSON object to handle our config file and data stores my $json = JSON->new->relaxed->pretty; # Read configuration my $cfg; # open my $config, '<', $conf_file or die "Can not read $conf_file: $!\n"; local $/; $cfg = $json->decode (); close $config; print Dumper $cfg; __DATA__ # Here is our config # There are many like it but this one is ours { ##################################################### # # # Data Base connections strings and active option # # # ##################################################### "DB_Connections" : { "foo" : { "conx" : [ "dbi:Oracle:FOO.world", "foo_user", "foo_pswd" ], "active" : 1 }, "bar" : { "conx" : [ "dbi:DB2:bar", "bar_user", "bar_pass", ], "active" : 0 } }, "hosts" : ( "host1" : ["readme", "andme"], "host2" : ["readthis", "that", "and another"], # comma allowed by relaxed ) }