A1 B1 C1 D1 A2 B2 C2 D2 A3 B3 C3 D3 #### my $runs = 1; # for testing code #my $runs = 1000; # 1_000 - the num of times we repeat #my $runs = 100000; # 10 _000 - the num of times we repeat #my $runs = 1000000; # 100_000 - the num of times we repeat # Program vars my $i; # a looping variable my $j; # another looping variable my $k; # another looping var my $range = 1552; # total number of array elements my @tmp; # empty array to push data into #Looping Variables my $pi; my $pi_sum; my $L; my $L_sum; my $differences; my $differences_sum; my $coverage; my $coverage_sum; ; ; my $chr_X_input = "bootstrap_data.txt"; open (CHR_X_INPUT, "<$chr_X_input") or die "can't open chromosome X input"; my @X_info = ; # Outer loop: Repeat "$runs" times for ($j = 0; $j < $runs; $j++) { for ($i = 0; $i < $range ; $i++) { # choose a randomly selected string of 4 elements from our array push (@tmp, $X_info[int(rand($range))]); } my @PAR1 = splice(@tmp, 0, 26,); for ($k = 0; $k < length(@PAR1) + 1 ; $k++) { my @PAR1_info = $PAR1[$k]; $pi = split('\t', $PAR1_info[0]); $pi_sum = $pi_sum + $pi; $L = split('\t', $PAR1_info[1]); $L_sum = $L_sum + $L; $differences = split('\t', $PAR1_info[2]); $differences_sum = $differences_sum + $differences; $coverage = split('\t', $PAR1_info[3]); $coverage_sum = $coverage_sum + $coverage; my $PAR1_diversity = (($pi_sum/$L_sum)/($differences_sum/$coverage_sum)); } }