Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This string is dynamic with the number of owners varying from 1 to many. I am wanting to split this string if its longer than say 45 characters. I want to split on the ',' that seperates each owner. egmy $owners = 'Shaun Anderson,Salve Barnao,James Clark,John Cross,Bruce + Jenkins,George Kelly,Danny Phipps & Robert Rendel';
Therefore it may be slightly less than 45 characters but that would be ok. This line of code is used in producing horse racebooks. Rather than having one line that is too long, I want to split it into 2 or 3 lines depending on the number of owners.my $owners1 = 'Shaun Anderson,Salve Barnao,James Clark,John Cross,'; my $owners2 = 'Bruce Jenkins,George Kelly,Danny Phipps & Robert Rendel +';
2005-10-02 Retitled by planetscape, as per Monastery guidelines
Original title: 'Split on character length'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split on field length
by japhy (Canon) on Sep 28, 2005 at 21:18 UTC | |
by goldclaw (Scribe) on Sep 29, 2005 at 12:13 UTC | |
|
Re: Split on field length
by ioannis (Abbot) on Sep 29, 2005 at 01:47 UTC | |
|
Re: Split on field length
by Zaxo (Archbishop) on Sep 29, 2005 at 12:26 UTC | |
by goldclaw (Scribe) on Sep 29, 2005 at 12:41 UTC | |
|
Re: Split on field length
by Anonymous Monk on Sep 28, 2005 at 21:41 UTC |