Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Expand Ranges in Lists of Numbers

by svsingh (Priest)
on Jun 08, 2003 at 15:46 UTC ( [id://264110]=note: print w/replies, xml ) Need Help??


in reply to Expand Ranges in Lists of Numbers

Nice. This can come in handy. My only suggestion (minor) would be to sort the list before you return it. Unless there's a reason you left that out or know that your input will always be in order. Thanks.

Replies are listed 'Best First'.
Re: Re: Expand Ranges in Lists of Numbers
by The Mad Hatter (Priest) on Jun 08, 2003 at 16:09 UTC
    Well, I'd prefer to leave the array in the order given (just in case the user wants it that way), but if you wanted it sorted you could do one of two things:
    1. Replace the line return @expanded; with return sort @expanded;
    2. When calling it, just sort the results. Ex/ my @results = sort expandRange($string);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-03-29 05:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found