in reply to Print series of numbers
$_ = join ',', sort{$a<=>$b} (1, 2, 3, 6, 9, 10, 13, 22, 20, 19, 15, 21); s/((\d+),)/$2 + 1 == $' ? "$2-" : $1/ge; s/(\d+-)[-\d]+-(\d+)/$1$2/g; $_; # the answer
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Print series of numbers
by spx2 (Deacon) on Oct 30, 2009 at 00:10 UTC |