* Jonathan E. Paton <[EMAIL PROTECTED]> [2002-11-20 20:51]:
> if (@array > $bound) {
> $array[$bound-1] = ", etc"; # Set element at boundary
> $#array = $bound-1; # Shorten array to boundary
> }
>
> print join ", ", @array;
Again, that's the same as:
join ', ', @array[0 .. $bound], @array > $bound ? 'etc' : ();
> Now, this I *might* use in production code. Of course, the
> obvious mistake is that space between the last element and
> the ", etc" part - but easily solved by using .= to append
> to the appropriate element.
No, it will look like "..blah, , etc" and that's easily
remedied by using just "etc" since the join adds its own
", " anyway.
--
Regards,
Aristotle