Q:

Perl:Shuffle an array 10 times, computing 10 average maxes, printing the mean average max. Repeat this entire process 1000 times

I have a data set which looks like the following
1. Dataset
NR_046018   DDX11L1 ,   0   0   1   1   1   1   1   1   1      1    0   0   0   0   1.44    2.72    3.84    4.92
NR_047520   LOC643837   ,   3   2.2 0.2 0   0   0.28    1   1   1   1   2.2 4.8 5   5.32    5   5   5   5   3
NM_001005484    OR4F5   ,   2   2   2   1.68    1   0.48    0   0.92    1   1.8 2   2   2   2.04    3.88    3
NR_028327   LOC100133331    ,   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

2. What is needed

Shuffle the array 10 times. After each shuffle, divide the array into 2 new arrays, say set1 and set2. (Half goes into set1 and other half goes to set2)
From each new array, compute maximum value of each row of numbers, followed by an average max for all rows.
Get 10 average maxes of each set1 and set2.(10 average maxes for 10 shuffles) Compute the average of the 10 average maxes obtained for each set, let's call it 10avg1 and 10avg2.
Get a list of 1000 10avg2 and 1000 10avg2.  

3.Code
use warnings;
use List::Util qw(max shuffle);

my $file = 'mergesmall.txt';

#Open file and output file
open my $fh,'<',$file or die "Unable to open file";
open OUT,">Shuffle.out" or die;

#Read into array
my @arr = <$fh>;

#Intialize loop for shuffling 10 times
my $i=10;
while($i){
    my @arr1 = ();  #Intitialize 1st set
    my @arr2 = ();  #Initialize 2nd set

    my @shuffled = shuffle(@arr);

    push @arr1,(@shuffled[0..1]); #Shift into 1st set
    push @arr2,(@shuffled[2..3]); #Shift into 2nd set

    foreach $_(@arr1){
        my @val1 = split;
        my $max1 = max(@val1[3..$#val1]);

         $total1 += $max1;
         $num1++;
    }

    my $average_max1 = $total1 /  $num1;
    #print "\n\n","Average max 1st set is : ",$average_max1;
    print OUT "Average max 1st set is : ",$average_max1;

        foreach $_(@arr2){
        my @val2 = split;
        my $max2 = max(@val2[3..$#val2]);

        print "\n\n";

         $total2 += $max2;
         $num2++;
    }

    my $average_max2 =  $total2 /  $num2;
    #print "\n\n","Average max 2nd set is : ",$average_max2;
    print OUT "\n","Average max 2nd set is : ",$average_max2,"\n\n";

    $i--;

}       

4. The Problem
The code I have been able to write so far can get 10 maximum averages of each set1 and set2. I am not able to figure out how to compute the average of these 10 maximum averages. If I can figure out this, I can easily put a for loop to run 1000 times and obtain 1000 10avgset1 and 1000 10avgset2
5. Points to Note

The actual data set has each row comprising a maximum of 400 numbers, some rows have less than that, some have none at all, but never more than 400.

2.The actual dataset has 41,382 rows. Set1 will comprise of 23,558 rows and set2 will comrpise of 17,824 rows.
3.File is a .txt file and all the numbers in each row are tab delimited.
I would be grateful if some idea could be provided as to how to compute average of maximum averages. I had thought of using push @10avgset1, $average_max1 but I am not able to make it work.

A:

First thing I noted: You aren't using the strict pragma, and are in fact using global variables. I am not sure if that is what you want. Also, variables names may not start with a digit (in general).
Second thing I noted: You repeat yourself quite a lot.
Here is a function that does this weird "averaging of maxima" stuff:
use constant CARRY => 1; # set behaviour of original code;

sub make_accumulator {
    my $group = shift;
    my ($max, $num) = (0, 0) if CARRY;
    my @acc;
    my $acc = sub {
        my ($max, $num) = (0, 0) unless CARRY;
        for (@_) {
            $max += max @$_;
            $num++;
        }
        my $avg = $max / $num;
        push @acc, $avg;
        printf "Average max in set %d is %.2f\n", $group, $avg;
        $avg;
    };
    my $get = sub { @acc };
    ($acc, $get);
}

We can then do my ($acc, $get) = make_accumulator(1), where $acc is a callback that encapsulates your algorithm, and $get returns the array of all such values computed so far.
A real average is computed with
sub average { sum(@_) / @_ }

To intitialize the script, I did
#!/usr/bin/perl

use strict;
use warnings;
use List::Util qw(shuffle max sum);

use constant CARRY => 1;

my @arr = map {my @arr = split; [@arr[3..$#arr]]} <DATA>;

my ($acc1, $get1) = make_accumulator(1);
my ($acc2, $get2) = make_accumulator(2);

The line for @arr parses the line only once, during loading.
I then go on to loop a few times over shuffeled versions of @arr:
for (1 .. 5){
    my @shuffled = shuffle @arr;

    my $halfway = int (@shuffled / 2);
    my @arr1 = @shuffled[0 .. $halfway];
    my @arr2 = @shuffled[$halfway .. $#shuffled];

    my $average_max1 = $acc1->(@arr1);
    my $average_max2 = $acc2->(@arr2);

    printf "running: %.2f %.2f\n", average($get1->()), average($get2->());
    print "\n";
}

Here, I split the shuffeled list strictly into halves, you want to hardcode 23557 later. I then print the running averages for set1 and set2.
This produces output like:
Average max in set 1 is 2.93
Average max in set 2 is 4.60
running: 2.93 4.60

Average max in set 1 is 3.17
Average max in set 2 is 4.60
running: 3.05 4.60

Average max in set 1 is 3.09
Average max in set 2 is 4.60
mrunning: 3.07 4.60

Average max in set 1 is 3.17
Average max in set 2 is 4.55
running: 3.09 4.59

Average max in set 1 is 3.22
Average max in set 2 is 4.03
running: 3.12 4.48

If I set CARRY to a false value, I get
Average max in set 1 is 3.07
Average max in set 2 is 5.12
running: 3.07 5.12

Average max in set 1 is 3.07
Average max in set 2 is 2.46
running: 3.07 3.79

Average max in set 1 is 3.07
Average max in set 2 is 4.40
running: 3.07 3.99

Average max in set 1 is 3.41
Average max in set 2 is 4.40
running: 3.15 4.10

Average max in set 1 is 3.07
Average max in set 2 is 5.12
running: 3.14 4.30

This looks stupid, because there are only very few possible combinations of four lines (n!/(n/2)!, I guess).
Of course these values differ every time they are run, because shuffle already is pseudo-random.
Edit:
The DATA filehandle assumes that you have a data section at the end of the script like
__DATA__
NR_046018   DDX11L1 ,   0   0   1   1   1   1   1   1   1      1    0   0   0   0   1.44    2.72    3.84    4.92
NR_047520   LOC643837   ,   3   2.2 0.2 0   0   0.28    1   1   1   1   2.2 4.8 5   5.32    5   5   5   5   3
NM_001005484    OR4F5   ,   2   2   2   1.68    1   0.48    0   0.92    1   1.8 2   2   2   2.04    3.88    3
NR_028327   LOC100133331    ,   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

To use whatever file is listed on the command line, do
my @arr = map {...} <>;  # no explicit filehandle

or open a file manually.

