On Thu, Nov 21, 2002 at 10:25:50AM -0600, Steven Lembark wrote: > > > -- Paul Makepeace <[EMAIL PROTECTED]> > > >So I'll stick with, > > > > my ($str, @tmp) = splice @names, 0, 90/3; > > $str .= ', '.shift @tmp while 90 > length($str . $tmp[0]); > > $str .= ', etc.' if @tmp; > > This does not limit the total string length to 90. The > final separator can force an item to dangle and so might > the final ', etc.'.
Of course. It's fiddling with a single number. Why not parameterize the whole thing and put some distracting math in there? Maybe an OO wrapper. Command line options. A web front end. A shiny box, support desk, and team of coked-up marketing executives... The algorithm itself is presumably the more interesting part. As I read it this was Lev's sentiment finding something "more elegant". Paul, who doesn't propose those three lines are any more elegant :-) -- Paul Makepeace ....................................... http://paulm.com/ "If I am here today, then an errant moth would burrow into your ear!" -- http://paulm.com/toys/surrealism/
