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--
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|