sub expand { my $range = shift; my @result; $range =~ s/[^\d\-\,]//gs; #remove extraneous characters my @items = split(/,/,$range); foreach (@items){ m/^\d+$/ and push(@result,$_) and next; my ($start,$finish) = split /-/; push(@result,($start .. $finish)) if $start < $finish; } return @result; }
You need to create an account or log in to post comments to this site.