# ----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 #### sub Build_totals_shares_for_sedol_Sell_side($$$) { #$j = shift; my $sedol = shift; my $shares = shift; $condition = ""; my $mySellfirstflag = shift; if ($mySellfirstflag eq "YES") { my $j = 0; } else { my $j = 1;} print "$sedol $shares\n"; $count = 0; if ($j == 0) { %Sellhash = ($sedol => $shares); #print "$Sellhash{key} \n"; foreach $sedolelement (keys %Sellhash) { print "Sell: The $sedolelement has traded\n"; foreach (@{$Sellhash{$sedolelement}}) { print "$_\n"; } } #$NumTradingSedols = 1; } else { #print "this is j $j\n"; foreach $sedolelement (keys %Sellhash) { #print "the key is: $sedolelement te sedol is $sedol\n"; if ($sedolelement eq $sedol) { $condition = "TRUE"; print "the sedol is in the list so add the shares.\n"; $usekey = $sedolelement; $oldshares = $Sellhash{$sedolelement}[1]; } else { $condition = "FALSE"; $count++; } } if (($condition eq "FLASE") && ($count != 0)) { $Sellhash{"$sedol"} .= $shares; print "the new entry is $sedol $shares\n"; } else { $Sellhash{"$sedol"} = $Sellhash{"$sedol"} + $shares; $newtotal = $Sellhash{"$sedol"}; print "the new total shares for sedol: $sedol is $newtotal\n"; } foreach $sedolelement (keys %Sellhash) { $total = $Sellhash{"$sedolelement"}; } } }