VGR has asked for the wisdom of the Perl Monks concerning the following question:

please do let me know why you think this doesn't work...
#!/usr/bin/perl -w print <<END_of_Multiline_Text; Content-type: text/html <HTML> <HEAD> <TITLE>Hello World</TITLE> </HEAD> <BODY> <H1>aaaaaaalo!</H1> </BODY> </HTML> END_of_Multiline_Text
the spaces seem to be right as well as in I checked for extra whilte spaces floating around...
This is the output i got on my screen!
Can't find string terminator "END_of_Multiline_Text" anywhere before E +OF at samp le.pl line 2.
I am currently installed perl V5.10.1 on cygwin.

Replies are listed 'Best First'.
Re: dumb question on multiline text
by almut (Canon) on Mar 02, 2010 at 21:39 UTC

    You're probably missing a newline on the last line (the one containing END_of_Multiline_Text).

      Quoth <<EOF in perlop:

      If the terminating identifier is on the last line of the program, you must be sure there is a newline after it ...
      ... then mentions the error message.

Re: dumb question on multiline text
by ww (Archbishop) on Mar 02, 2010 at 22:07 UTC

    Have to agree with toolic (I did, initially, and then found my error, below) -- even with strict habitually added (and highly recommended).

    However: if you're building a model for actual use with a server and browser, you're going to need to add two newlines to your Content-type... line, thusly

    Content-type: text/html\n\n

    or, two returns:

    #!/usr/bin/perl use strict; use warnings; #826261 print <<END_of_Multiline_Text; Content-type: text/html <HTML> <HEAD>...

    Update: But maybe he did what I did and inadvertently added a trailing newline after OP's code. Deleting it gives OP's error; hence, ++ almut

    At least in my case, this argues for moving the trailing semi-colon from the line print <<END_of_Multiline_Text; to the line following the end of the heredoc, thus:

    #!/usr/bin/perl use strict; use warnings; #826261 # alt re content-type: "Content-type: text/html (followed by two bla +nk lines) # if no newline after 19, perl reports "Can't find string terminator " +END_of_Multiline_Text" anywhere before EOF at 826261.pl line 9." print <<END_of_Multiline_Text Content-type: text/html\n\n <HTML> <HEAD> <TITLE>Hello World</TITLE> </HEAD> <BODY> <H1>aaaaaaalo!</H1> </BODY> </HTML> END_of_Multiline_Text ;
Re: dumb question on multiline text
by afoken (Chancellor) on Mar 02, 2010 at 20:56 UTC

    Re-read the error message. No, really. There is no line in your code containing just "END_of_Multiline_Text".

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re: dumb question on multiline text
by toolic (Bishop) on Mar 02, 2010 at 21:46 UTC
    Download the code from your own posting, and copy'n'paste it into a new editor. It worked for me; I don't get your message. I bet it will just work for you too.