my $list = "2-4,10-12"; $list =~ s/\-/../g; my @array = eval( $list ); # @array is now (2,3,4,10,11,12)