in reply to regex to an array , is there a better way to do this
my @array = map { /^(\d+)\.\.(\d+)$/ ? $1..$2 : $_ } split /,/, $seq;
If you're worried about overlaps and/or duplicates,
my %seen; my @array = grep !$seen{$_}++, sort { $a <=> $b } map { /^(\d+)\.\.(\d+)$/ ? $1..$2 : $_ } split /,/, $seq;
|
---|
In Section
Seekers of Perl Wisdom