http://qs1969.pair.com?node_id=778351


in reply to regex to an array , is there a better way to do this

You can even cut it down to
chomp(my $number = <STDIN>); my @array; foreach (split(",", $number)) { push @array, /(\d+)\.\.(\d+)/ ? $1..$2 : $_; } print "@array\n";
I don't think it is quite as clear what is going on at this level of compression.