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
|