in reply to Perl Module - take in a String, output object
You didn't say what you wanted this object to do...
If you want it to store the range list, and then be used as a sort of iterator, then you might want to split the work in two:
during the initialisation of the object, validate the ranges, remove all duplicates and overlaps and store the resulting list of ranges in ascending order.
implement a "next" method for use:
while (my $num = $range->next) { }
housekeeping to reset the iterator, test its state etc.
|
|---|