Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

(Golf) showing runs

by nop (Hermit)
on Jun 27, 2001 at 22:46 UTC ( #92039=perlquestion: print w/replies, xml ) Need Help??
nop has asked for the wisdom of the Perl Monks concerning the following question:

Can anyone suggest a golfish way to take a sorted array like  @a = (1,2,3,4, 55, 101,102,888) and produce a list of singles and runs (a run is 3 or more conseq integers) like this: 1-4, 55, 101, 102, 888
My solution is ugly and long. Thanks. nop

Replies are listed 'Best First'.
Re: (Golf) showing runs
by japhy (Canon) on Jun 28, 2001 at 00:40 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://92039]
Approved by root
help
Chatterbox?
[Corion]: A good daystart to everybody!
[Corion]: Just a quick poll - is anybody actively relying on https://perlmonks. pairsite.com/? I plan to retire that URL in favour of moving all our servers onto the same HTTPS certificate for perlmonks.{com, net,org}
[Corion]: Actually bsd_glob '{www.,}perlmonks .{com,net,org}', plus css.perlmonks.org I think
[Corion]: Sad that Let's Encrypt does not allow wildcard certificates, but they could be somewhat of a hassle to verify

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2017-09-26 07:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (292 votes). Check out past polls.

    Notices?