# Inputs my $runs = 100000; # 1e5 - the num of times we repeat the experiment # Program vars my $i; # a looping variable my $j; # another looping var my $range = 1553; # the number of total windows with data my $count = 0; # variable tracking pseudo X output files # Outer loop: Repeat "$runs" times for ($j = 0; $j < $runs; $j++) { for ($i = 0; $i < $range + 1 ; $i++) { # choose a randomly selected string chomp @X_info; my @get_X = split('\s+', $X_info[int(rand($range))]); my $output_file = "/Users/statistical_analysis/pseudo_X/pseuo_X_"."$count".".txt"; open (OUT, ">$output_file") or die "can't open output file"; print OUT "@get_X\n"; } } $count++;