On Wed, Nov 20, 2002 at 02:07:18AM -0600, Steven Lembark wrote:
> >my ($i, $total);
> >($total += length) < 90 ? $i++ : last for @ARGV;
> >$str = join ', ', @ARGV[0 .. $i];
> >$str .= ', etc' if $i < $#ARGV;
> 
> my $a = substr join( ',', @namz ), 0, 89;
> $a .= ',etc...' if length $a == 90;

That was my first try, but it doesn't work since the substr will often
cut off in the middle of a word and you wind up with things like 
"foo,foo,f,etc..."

Also, substr()'s LENGTH argument is just that.  Its not one-off like an
array index.  If you want 90 characters you say 90 not 89.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
Good tidings, my native American Indian friend!  America will soon again
be yours!  Please accept 5th Avenue as an initial return!

Reply via email to