# ----Build_Country_List ----------------- sub Build_Country_List ($$) { my $j = shift; my $country = shift; print "build country list\n"; $count = 0; if ($j == 0) { print "initial loop\n"; $CountryList[$j] = $country; foreach $tradingcountry (@CountryList) { print "array $j $tradingcountry\n"; } $LengthofCountryList = 1; } else { foreach $tradingcountry (@CountryList) { if ($tradingcountry eq $country) $condition = "FALSE"; $count++; } else { $condition = "TRUE"; } } } if (($condition eq "TRUE") && ($count == 0)) { $LengthofCountryList = scalar(@CountryList); $CountryList[$LengthofCountryList] = $country; } foreach $tradingcountry (@CountryList) { print "country elements $tradingcountry\n"; } $LengthofCountryList = scalar(@CountryList); } # end sub Build_Country_List