in reply to Perl Module for dealing with number ranges
I recently had this same problem. Not realizing there might be a CPAN module (I know, I know, what was I thinking?), I came up with this sub:
sub expandlist { local $" = '..'; # locally set list separator my (@parts); sort {$a <=> $b} map { map { ((@parts = split /-/) == 2) ? eval('map {$_} '. "@parts") : $_ } split /,/ } @_; }
Briefly:
Crude and hardly idiot-proofed, but it works without having to get a CPAN module installed on all our servers.
dmm
Procrastinate NOW! Don't put it off... --Ellen Degeneres
|
---|