I have a small script that acts like fortune in that it prints a random quote from a file of quotes. I currently use Text::Autoformat to (very nicely) format my paragraphs. My problem is that some of the quotes are quite long, eg, greater than 30 to 50 lines in length, and the text scrolls off the top of the screen.

Does anyone know of a way to split the text output into two columns if the length of the text output is greater than some arbitrary length? I.e., use one column if the length is less than a set number of lines and two if the length is greater than the pre-determined limit. I really like what Text::Autoformat does to my data so I would like to continue to use it to format my paragraphs.

Is this possible?

Thanks!


In reply to Two Column Output with Text::Autoformat by bohrme

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.