sub mklist() { my $config = "/home/portal/test/performance.conf"; my %ini; tie %ini, 'Config::IniFiles', ( -file => $config); push @hostnames, keys%{$ini{'performance'}}; push @ips, values%{$ini{'performance'}}; #print "Hosts: @hostnames\n\n"; #print "IPs: @ips\n\n"; for (my $i = 0; $i < @hostnames; $i++) { push @slots, keys%{$ini{'$hostnames[$i]'}}; ## Here something is wrong... push @ifindices, values%{$ini{'$hostnames[$i]'}}; } print "Slots: @slots\n\n"; ## this prints nothing print "Indices: @ifindices\n\n" ## this prints nothing as well... }