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.
In reply to Re: Understanding this code
by hippo
in thread Understanding this code
by aaron.schweitzer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |