#construct 2D array for (my $e = 0; $e < @dim1; $e++) { $arr_1[$e] = [ @array ]; } # fill array for (my $i = 0; $i < 10; $i++) { @tmp_array = undef; for (my $e = 0; $e < @suff; $e++) { $tmp_array[$e] = $e; } push @{ $arr_1[$i] }, [ @tmp_array ]; } # Get the indices from the sorted list @indices = sort { $arr2sort[$a] <=> $arr2sort[$b] } 0..$#arr2sort; # Sort the 3D array? for (my $e = 0; $e < @suff; $e++) { @{ $arr_1[$i] } = @{ $arr_1[$i][@indices] }; }