in reply to here doc

To make it explicit: Here-docs are simply strings with a special quoting style. They can be used anywhere you would use a string.

Replies are listed 'Best First'.
(tye)Re: here doc
by tye (Sage) on Jan 08, 2001 at 09:48 UTC

    Well, one thing about them that might catch some by surprise is that a here-doc comes in two pieces and those two pieces can end up pretty far apart. Take an example:

    print <<FOO, <<'BAR'; Usage: $0 [arguments] FOO This program doesn't do much. BAR
    If here-docs were just like strings and didn't come in two parts, then you'd want to write that more like:
    print <<FOO Usage: $0 [arguments] FOO, <<'BAR' This program doesn't do much. BAR;
    which doesn't work. You can write it like this:
    print <<FOO Usage: $0 [arguments] FOO , <<'BAR' This program doesn't do much. BAR ;
    but I think the first example is easier to read.

            - tye (but my friends call me "Tye")