in reply to joining and sorting arrays

It sounds like you want the big array, before it's sorted, to be all the numbers 1 to n in sequence. Is that right? If so, TIMTOWTDI, but the following will give you an array (@probs) of all the numbers that are not exactly one larger than the one before:
push @probs, grep {pop @array != $array[$#array] + 1} @array;


§ George Sherston