http://qs321.pair.com?node_id=100123


in reply to Wordwrap text

You should rely on HTML to do this - just specify the width of the column, preferably with a percentage:
<td width="25%">big long sentance . . .</td>
UPDATE:
The following _hack_ will work, but it's nasty:
use constant POS => 10; my $str = 'big old long sentance blah blah blah'; my $len; foreach (split(/\s/,$str)) { $len += length; print; ($len % POS) ? print ' ' : print '<br>'; }
UPDATED UPDATE:
Thanks nardo - that's what i get for changing my code from the testing board to the posting board (this cleverness thing just isn't working out for me today). Besides, a ternary operator in void context is evil. . . .
#inside foreach $len += length; print; if ($len > POS) { # thanks nlafferty print '<br>'; $len = 0; } else { print ' '; }

Jeff

R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
L-L--L-L--L-L--L-L--L-L--L-L--L-L--