Hello dear Monks.
Say, I have a sorted list like this:
I want to transform it to:
So that ranges of numbers are spelled as ranges, not as lists.
I know how to solve the inverse problem:
my $span = Set::IntSpan->new('1-4,9,16,22-24,30,35');
print join "," => $span->elements();
would give me
. Is there a way to make ranges from a list? Maybe, modules similar to Set::IntSpan, or some algorithm?..
Thanks in advance.