Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Humanized lists of numbers

by gryphon (Abbot)
on Jun 23, 2001 at 01:40 UTC ( #90879=note: print w/replies, xml ) Need Help??


in reply to Humanized lists of numbers

After some thought, I'd like to modify the if to this:

if (($array[$x] + 1 == $array[$x+1]) && ($array[$x] + 2 == $array[$x+2])) {

That way you don't end up with display-length sub-lists like "1-2, 4-5" in lists. Again, I'm sure there's a better way, but...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2023-02-08 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (40 votes). Check out past polls.

    Notices?