[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Formatting integer sets with ranges



On Fri, 7 Jan 2000, John Porter wrote:
>
>sub int_ranges(@) {
>  @_ = map { $_, '-' } sort { $a <=> $b } @_;
>  pop;
>  local $_ = join '', map {
>    $_[$_] eq '-' && $_[$_-1] != $_[$_+1]-1 ? ',' : $_[$_]
>  } 0 .. $#_;
>  s/-[^-]-/-/g;
>  $_
>}

Sorry, I should have looked at this...


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe