for ($aaa=0; $aaa<=$#unique_species; $aaa++) # The @unique_species is Chimp,Dog,Horse,Human,Monkey,Pig,Rat { @brk_species_name=split /\_/,$unique_species[$aaa]; my $speciesName= lc($brk_species_name[0]); @{"$speciesName"."_brk"}=0; foreach $cor(0..$#target_species) { if ("$target_species[$cor]" eq "$unique_species[$aaa]") { #print "$target_species[$cor]\t$unique_species[$aaa]\t$target_brk_cordinates[$cor]\n"; push @{"$speciesName"."_brk"},"$target_brk_cordinates[$cor]"; } } @{"$speciesName"."_brk"}=sortUniqueHash (@{"$speciesName"."_brk"}); my $arrayEntries=checkNumber (@{"$speciesName"."_brk"}); push (@allDecision, $arrayEntries); push (@allBreakpointCoordinates, @{"$speciesName"."_brk"}); @{"$speciesName"."_brk"}=join (',',@{"$speciesName"."_brk"}); ## it generate one string and enter in an array } # Chimp,Dog,Horse,Human,Monkey,Pig,Rat same order as sps file names in matrix .... Need to change ... @matrix=\(@species,@chromosome,@brk_cordinates,@brk_decision,@chimp_brk,@dog_brk,@horse_brk,@human_brk,@monkey_brk,@pig_brk,@rat_brk); #print "Print Using Array Index\n"; for(my $i = 0; $i <= $#matrix; $i++){ # $#array_2d gives the highest index from the array for(my $j = 0; $j <= $#matrix ; $j++){ print OUTFILE "$matrix[$i][$j] "; } print OUTFILE"\t"; } print OUTFILE "\n"; undef @target_species; undef @species; undef @chromosome;undef @matrix; undef @brk_cordinates; undef @target_brk_cordinates; undef @da; undef @brk_decision; undef @dog_brk; undef @horse_brk; undef @monkey_brk; undef @pig_brk; undef @human_brk; undef @chimp_brk; undef @rat_brk; undef @mouse_brk; undef @pig_brk; undef @dog_brk; undef @horse_brk; undef @cattle_brk; undef @allBreakpointCoordinates; undef @all_sps_array; undef @allDecision; undef @matrix;