if (scalar @missing) #### scalar @array == ($#array + 1) # is always true unless you redefine where the index starts. for my $i (0..$#array) { # loops through the array by index number }