http://qs321.pair.com?node_id=123631


in reply to Re: Finding missing elements in a sequence (code)
in thread Finding missing elements in a sequence (code)

Are all the numbers zero padded to the same length?? Then see my answer below but use the default sort instead of the numeric sort in both places. The first numeric sort is 'numerifying' the strings and stripping the leading zeroes which messes up the rest of the routine.

Update: Ok, its not necessarily the first sort stripping the zeroes (in my test case, I was doing a numeric sort before I called the sub, so that's what I was seeing), but it does cause the subsequent statements to treat the list as numbers instead of character strings. So you should treat them as either numbers or characters throughout the sub (like using the +0 trick to begin with), but not both.