in reply to regex to an array , is there a better way to do this
You can even cut it down to
I don't think it is quite as clear what is going on at this level of compression.chomp(my $number = <STDIN>); my @array; foreach (split(",", $number)) { push @array, /(\d+)\.\.(\d+)/ ? $1..$2 : $_; } print "@array\n";
|
---|
In Section
Seekers of Perl Wisdom