Simple PERL Problem

Posted by Suezy on Stack Overflow See other posts from Stack Overflow or by Suezy
Published on 2010-04-21T05:26:44Z Indexed on 2010/04/21 5:33 UTC
Read the original article Hit count: 235

Filed under:
|

I have an array of numbers:

@numbers = 1,2,3,6,8,9,11,12,13,14,15,20

and I want to print it this way:

1-3,6,8-9,11-15,20

Any thoughts? Of course I tried using the most common "looping", but still didn't get it.

© Stack Overflow or respective owner

Related posts about perl

Related posts about array