Syntactic Confectionery Delight | |
PerlMonks |
Re: Finding missing elements in a sequence (Rewritten code)by demerphq (Chancellor) |
on Nov 06, 2001 at 22:01 UTC ( [id://123641]=note: print w/replies, xml ) | Need Help?? |
Well, I cant see anything obviously wrong with this, except that it uses unobvious methods to accomplish its task and is therefore difficult to understand. If I understand you right this is the opposite of the 'rangification' problem that pops up in various places on a regular basis. In that problem one wishes to take a set of numbers and convert them into a format of begin-end. Your problem (if I understand it correctly) is even easier. You wish to go through a list of numbers to find missing elements in the list. So as I couldnt see what was wrong I decided Id write a quick sub to do the same thing but is a bit more obvious (and less of a memory hog, and presumably faster to boot :-) Note that there is no need for the hash nor the grep.
Apologies if Ive completely missed the point of your routine. HTH
Yves / DeMerphq
In Section
Seekers of Perl Wisdom
|
|