Hello,

I am working on making an index of a book.  I have many numbers that I must 
sort in ascendent order -- but indices in books require a special format. 
Say that I have a list of number like this:

(15, 18, 30, 31, 42, 45, 46, 47)

the output must be:

15, 18, 30-31, 42, 45-47

I.e. consecutive numbers must be joined with "-".  I cannot figure out how 
to do it in Perl script.  I would appreciate very much if someone could 
give me a clue.

Thank you very much in advance!

Best regards,

Nobumi Iyanaga
Tokyo,
Japan

Reply via email to