>> I am looking for a simple Perl way to decode the following, which can be any
>> grouping of number
>> 
>>    2-8,9,11,18-21
>> 
>> Into
>>    2,3,4,5,6,7,8,9,11,18,19,20,21
> 
> $ perl -le' print join ",", map /(\d+)-(\d+)/ ? $1 .. $2 : $_, split /,/,
> "2-8,9,11,18-21"'
> 2,3,4,5,6,7,8,9,11,18,19,20,21


Ouch, John, you turned my 9 lines into 1?!  Impressive.

- B



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to