In message <[EMAIL PROTECTED]> "Selector, Lev Y" <[EMAIL PROTECTED]> wrote:
> Folks, > > Simple question: > Is there a more elegant way to express this: > an array of names is converted into a comma-separated list. > if the list gets to long - limit it and add ", etc." at the end. > > $str = join ', ', @names; > if (length($str)>90) { > ($str = substr($str,0,90)) =~ s/,[^,]*$/, etc./; > } > How about: $str = join ', ', @names; if ( length($str) > 90 ) { substr($str,rindex($str,",",90)) = ", etc."; } Dave. -- No, the fact that it's an infinite loop doesn't mean the program doesn't work; it just entered a state with which I was previously unfamiliar. Calum - Acorna, A.McCaffrey & M.Ball