The text said:

    "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."

but, the code said:

    $str = join ', ', @names;
        if (length($str)>90) {
            ($str = substr($str,0,90)) =~ s/,[^,]*$/, etc./;
        }

So, when in doubt... which do you believe?  "Use the source Luke"
springs to mind.  My fix is to repair the text with:

    s/list g/line length g/;

Now, looking at the original code it looks quite sensible for
the task in hand.  Wonder if anyone else in the string of posters
noticed that... I'm too lazy to look back over the growing list of
mail on this topic though.
Extreme nit:

Original doesn't mention if the "etc." should fall w/in the
90 char's or not. In that case you'd have to use a length
for the substr that leaves room for the trailer.


--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                           +1 800 762 1582

Reply via email to