here document 相关资料

here document 相关资料

###链接http://perldoc.perl.org/perlop.html
<<EOF
A line-oriented form of quoting is based on the shell "here-document" syntax. Following a << you specify a string to terminate the quoted material, and all lines following the current line down to the terminating string are the value of the item. The terminating string may be either an identifier (a word), or some quoted text. If quoted, the type of quotes you use determines the treatment of the text, just as in regular quoting. An unquoted identifier works like double quotes. There must be no space between the << and the identifier, unless the identifier is quoted. (If you put a space it will be treated as a null identifier, which is valid, and matches the first empty line.) The terminating string must appear by itself (unquoted and with no surrounding whitespace) on the terminating line.

       print <<EOF;
    The price is $Price.
    EOF       print << "EOF"; # same as above
    The price is $Price.
    EOF       print << `EOC`; # execute commands
    echo hi there
    echo lo there
    EOC       print <<"foo", <<"bar"; # you can stack them
    I said foo.
    foo
    I said bar.
    bar       myfunc(<< "THIS", 23, <<'THAT');
    Here's a line
    or two.
    THIS
    and here's another.
    THATJust don't forget that you have to put a semicolon on the end to finish the statement, as Perl doesn't know you're not going to try to do this:

       print <<ABC
    179231
    ABC
       + 20;If you want your here-docs to be indented with the rest of the code, you'll need to remove leading whitespace from each line manually:

    ($quote = <<'FINIS') =~ s/^\s+//gm;
       The Road goes ever on and on,
       down from the door where it began.
    FINISIf you use a here-doc within a delimited construct, such as in s///eg, the quoted material must come on the lines following the final delimiter. So instead of

    s/this/<<E . 'that'
        the other
        E
          . 'more '/eg;you have to write

    s/this/<<E . 'that'
          . 'more '/eg;
    the other
    E

不明白你有什么问题。
here document的语法错了:
print <<END_OF_DATA

...................

END_OF_DATA
对不起,打扰大家了。
问题得到解决,由于自己没有仔细检查。