MikeEndo has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to design and implement a Perl module which takes a range list in string form and turns it into an object which represents the corresponding list of numbers and allows the calling code to access the list.
This is a bit of background:An email server may be asked to operate on a number of messages at a time (e.g. 'DELETE' or 'FETCH'). Each message is identified by a number, and the messages a particular operation applies to is specified by a range-list. (e.g. DELETE 1, 4, 6-10)
A range-list is specified as a string of comma-separated elements (with optional whitespace). Each element is either a single number or a range (e.g. 10-20). A range is inclusive (i.e. it includes both end-points, so the range 10-12 includes messages 10, 11 and 12). Numbers may be specified multiple times, and ranges may overlap. The list may be in any particular order.
Examples:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Module - take in a String, output object
by oko1 (Deacon) on Nov 19, 2008 at 22:57 UTC | |
|
Re: Perl Module - take in a String, output object
by Fletch (Bishop) on Nov 19, 2008 at 20:49 UTC | |
|
Re: Perl Module - take in a String, output object
by Your Mother (Archbishop) on Nov 19, 2008 at 21:18 UTC | |
by massa (Hermit) on Nov 20, 2008 at 00:04 UTC | |
|
Re: Perl Module - take in a String, output object
by gone2015 (Deacon) on Nov 20, 2008 at 00:43 UTC |