Since I just replied to someone's post, and directed them to my List-to-Range node, I thought I'd rehash this one, and pare it down by ONE stroke (from the best answer given).
# 30 + 38 = 68
sub num2range {
#2345678901234567890123456789012345678
local$_=join',',sort{$a-$b}@_;
s/\b(\d+)(,((??{$++1})))+\b/$1-$+/g;$_
}
_____________________________________________________
Jeff
[japhy]Pinyan:
Perl,
regex,
and
perl
hacker, who'd like a
job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;