in reply to loop iterator in a string
If you don't mind using a dash instead of two dots, you might be interested in Set::IntSpan. See the example of its next method in the Synopsis for how to interate through the set. Just don't use the indirect object syntax as it is shown in the documentation, i.e. write Set::IntSpan->new instead of new Set::IntSpan, use $set->insert($n) instead of insert $set $n, and so on.