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);