Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Get ranges from a list of numbers (like 1,2,3 => 1-3)

by SuicideJunkie (Priest)
on Apr 09, 2013 at 16:52 UTC ( #1027787=note: print w/ replies, xml ) Need Help??


in reply to Get ranges from a list of numbers (like 1,2,3 => 1-3)

Quoth the CPAN:

print $set->as_string(), "\n"; # prints 1,3,5,7,9,100-1000000

It sounds like Set:IntSpan already does what you want. Just keep reading down the page a little further to Getting Set Contents


Comment on Re: Get ranges from a list of numbers (like 1,2,3 => 1-3)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027787]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-11-23 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (134 votes), past polls