start page | rating of books | rating of authors | reviews | copyrights

Programming Perl

Programming PerlSearch this book
Previous: 7.2.70 Text::Tabs - Expand and Unexpand Tabs Chapter 7
The Standard Perl Library
Next: 7.2.72 Tie::Hash, Tie::StdHash - Base Class Definitions for Tied Hashes
 

7.2.71 Text::Wrap - Wrap Text into a Paragraph

use Text::Wrap;  $Text::Wrap::columns = 20; # default is 76 $pre1 = "\t";              # prepend this to first line of paragraph $pre2 = "";                # prepend this to subsequent lines print wrap($pre1, $pre2, "Hello, world, it's a nice day, isn't it?");

This module is a simple paragraph formatter that wraps text into a paragraph and indents each line. The single exported function, wrap() , takes three arguments: a string to prepend to the first output line; a string to prepend to each subsequent output line; and the text to be wrapped.

$columns is exported on request.


Previous: 7.2.70 Text::Tabs - Expand and Unexpand Tabs Programming Perl Next: 7.2.72 Tie::Hash, Tie::StdHash - Base Class Definitions for Tied Hashes
7.2.70 Text::Tabs - Expand and Unexpand Tabs Book Index 7.2.72 Tie::Hash, Tie::StdHash - Base Class Definitions for Tied Hashes