in reply to Split on field length

Yet another way.

my $owners = "Shaun Anderson,Salve Barnao,James Clark,John Cross,Bruce + Jenkins,George Kelly,Danny Phipps & Robert Rendel"; my @owners; push @owners, substr( $owners, 0, 1+rindex($owners,",",45), "") while 45 < length $owners; push @owners, $owners; print $_, $/ for @owners;' __END__ 123456789012345678901234567890123456789012345 Shaun Anderson,Salve Barnao,James Clark, John Cross,Bruce Jenkins,George Kelly, Danny Phipps & Robert Rendel

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Split on field length
by goldclaw (Scribe) on Sep 29, 2005 at 12:41 UTC
    This is the way of doing it that hangs forever if a name is longer than 45 char's:-)

    gc