in reply to Converting String Containing Ranges to Array

Set::IntSpan
use strict; use warnings; use Set::IntSpan; my $s = "1,5,7..10,15,17..19,22"; $s =~ s/\.\./-/g; my $set = Set::IntSpan->new($s); my @elements = $set->elements(); print Dumper(\@elements); __END__ $VAR1 = [ 1, 5, 7, 8, 9, 10, 15, 17, 18, 19, 22 ];