Have a look at Text::Format at CPAN. The following is straight from the documentation
$text = Text::Format->new (
{
text => [], # all
columns => 72, # format, paragraphs, center
leftMargin => 0, # format, paragraphs, center
rightMargin => 0, # format, paragraphs, center
firstIndent => 4, # format, paragraphs
bodyIndent => 0, # format, paragraphs
rightFill => 0, # format, paragraphs
rightAlign => 0, # format, paragraphs
justify => 0, # format, paragraphs
extraSpace => 0, # format, paragraphs
abbrevs => {}, # format, paragraphs
hangingIndent => 0, # format, paragraphs
hangingText => [], # format, paragraphs
noBreak => 0, # format, paragraphs
noBreakRegex => {}, # format, paragraphs
tabstop => 8, # expand, unexpand, center
}
); # these are the default values
Justify is the attribute that you need to look at
justify 0 || 1 || NOTHING
Set justify or retrieve its value. Text is aligned with both margins,
adding extra spaces as necessary to align text with left and right margins.
Keep in mind that if either of rightAlign or rightFill are set then justify is ignored, even if both are set in which case they are all ignored.
Hope this helps
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.