use TestFormat;
use strict;
use warnings;

use Exporter;

our @ISA    = qw /Exporter/;
our @EXPORT = qw /format_number_list expand_number_list/;

sub format_number_list {
    local $" = ", ";
    local $_ = "@_";
    1 while s/(\d-)?(-?\d+), (-?\d+)(?(?{$2 + 1 == $3})|x)/$1?"$1$3":"$2-$3"/e;
    return $_;
}

sub expand_number_list {
    map {/(?<=\d)-/ ? $` .. $' : $_} split /,\s*/ => shift
}

1;

__END__


Abigail
