use strict; use warnings; my @list; foreach my $DIR qw(TEST_DIR WINS_DIR) { if (defined($ENV{"$DIR"})) { my $filename = $ENV{"$DIR"} . "/common/wins.ini"; if (-s $filename) { open (IN,$filename); my @newList = ; close (IN); chomp @newList; push @list, @newList; } } }