On Dec 17, Bob Showalter said:

>Here's what I came up with. I wonder if this can be made shorter:
>
> while ($f = shift @list) {
>     print $f;
>     last unless @list;
>     print(','), next unless $list[0] == ++$f;
>     print "-";
>     shift @list while @list > 1 && $list[1] == ++$f;
> }

It certainly puts my C-like code to shame.  It's very nice.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to