in reply to Generating ranges of numbers
It is definitely more fun if you *don't* use Set::IntSpan...
#!/usr/bin/perl use strict; use warnings; use Set::IntSpan; my @array = ("1", "2", "3", "5", "6", "7", "9"); my $set = Set::IntSpan->new(\@array); my $out = join(',', $set->D($set->holes())); print $out, "\n";
OUTPUT: 1-3,5-7,9
*My* tenacity goes to eleven...
|
---|
In Section
Seekers of Perl Wisdom