[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-date: Thu Jan 20 16:31:09 2005 -->
- <!--x-from-r13: syrgpu ng culqrnhk.bet (syrgpu ng culqrnhk.bet) -->
- <!--x-message-id: [email protected] -->
- <!--x-subject: [ale] Perl Split Question -->
- <li><em>date</em>: Thu Jan 20 16:31:09 2005</li>
- <li><em>from</em>: fletch at phydeaux.org (fletch at phydeaux.org)</li>
- <li><em>subject</em>: [ale] Perl Split Question</li>
- Writes: Christopher> Is there a way to use split to split a string into Christopher> segments of N characters. I want to automatically Christopher> wrap a long text string onto multiple lines.
Quick and dirty if you don't mind breaking in the middle of words and
being destructive to your source string (copy beforehand otherwise):
my @lines;
push @lines, substr( $str, 0, $max_len, '' ) while $str;
The CPAN way:
<a rel="nofollow" href="http://search.cpan.org/~dconway/Text-Autoformat-1.12/lib/Text/Autoformat.pm">http://search.cpan.org/~dconway/Text-Autoformat-1.12/lib/Text/Autoformat.pm</a>
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00828.html">[ale] Perl Split Question</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00830.html">[ale] NW meeting tonight</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00838.html">[ale] Perl Split Question</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00839.html">[ale] Linux Does it Again!</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00829"><strong>Date</strong></a></li>
<li><a href="threads.html#00829"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>