use Set::IntSpan; # CPAN rules :-) use strict; sub expand_number_list { my $run = shift; my $set = Set::IntSpan->new($run); $set->elements; } #### use Set::IntSpan; # CPAN rules :-) use strict; sub format_number_list { my(@n) = @_; my $set = Set::IntSpan->new(join ",", @n); my $run = $set->run_list; $run =~ s/,/, /g; # give them the spaces $run; }