Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: List-to-Range generation

by chipmunk (Parson)
on Jun 12, 2001 at 02:55 UTC ( #87672=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub num2range {
      local $_ = join ',' => @_;
      s/(?<!\d)(\d+)(?:,((??{$++1}))(?!\d))+/$1-$+/g;
      return $_;
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (14)
As of 2014-09-02 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls