#!/usr/bin/perl use strict; use warnings; @::globalclusters=qw[tokyo oslo milan lima lagos hanoi cairo]; my $hashref = {}; for $::clustername (@::globalclusters) { open (FILE, "conf/$::clustername.conf") or die "Can't open $::clustername.conf to read configuration - Please check: $!\n"; while( ) { s/#.*//; # ignore comments by erasing them next if /^(\s)*$/; # skip blank lines chomp; # remove trailing newline characters # push @::lines, $_; # push the data line onto the array $hashref->{$clustername}->{$_} = 0; } close FILE; } foreach my $cluster ( keys %$hashref ) { my $elements = $hashref->{$cluster}; foreach my $host ( keys %$elements ) { my $values = $elements->{$host}; print "host: $host\n"; print "Value : $value\n"; } }