in reply to Understanding this code
I was expecting missing_ids_list to have less elements than idslist since the loop goes only through this number.
I think you may have missed the original premise in the thread which you referenced which was:
Given an arbitrarily long list of numbers that SHOULD be consecutive, is there a simple method of finding any missing numbers?
So, given a list like
my @idslist = (100,200,300);you can see that the number of missing IDs exceeds the number in @idslist.
The code snippet you have quoted (from here?) works by pushing ascending lists of the values between consecutive items of @idslist onto the missing list. If the values in @idslist are not consecutive (or not ascending) then nothing is pushed. Hope that explains it for you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Understanding this code
by aaron.schweitzer (Novice) on Sep 28, 2015 at 09:03 UTC |