in reply to best way to print paragraphs of text

Just quote your text and print it:
if($today eq 'Monday') { print q(Today is Monday, my favorite day of the week. It is my fa +vorite day because Jerry said "Monday is the best day of the week". +Tuesday is my second-favorite day. Why can't all days be as great as + Monday? Who knows.); }

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: best way to print paragraphs of text
by AnomalousMonk (Archbishop) on Aug 08, 2009 at 22:31 UTC
    Further to CountZero's post:

    A here-doc is, to my way of thinking, intended to deal with multiple lines having embedded newlines. The examples given in the OP use a single, very long line with no newlines. If this is, indeed, the type of string keiusui intends to print, then, as CountZero says, just print it and forget about here-docs.

    If one intends to print a string consisting of several lines (i.e., with embedded newlines) using a here-doc, then you are stuck with an approach such as those outlined by desemondo.

Re^2: best way to print paragraphs of text
by SFLEX (Chaplain) on Aug 09, 2009 at 10:04 UTC
    Then you would want to to it like this.

    print <<OUTPUT if $today eq 'Monday'; Today is Monday, my favorite day of the week. It is my favorite day b +ecause Jerry said "Monday is the best day of the week". Tuesday is m +y second-favorite day. Why can't all days be as great as Monday? Wh +o knows. OUTPUT


    Update: This was ment to be a reply to the OP's question and i didnt read the OP's post fully.

    Information is knowledge.