Please explain how to use EOF

In one perl script I use this and it works fine:
print header;
print start_html(‘Thank you’);
print <<EOF;
All my HTML code
EOF

I a second perl script I use the exact same thing, and I receive the error:
Can’t find string terminator “EOF” anywhere before EOF at . . .

Can someone exlain to me the rules in how to use EOF to use html in a perl program?

My only other solution when EOF does not work is to put each HTML line in its own print “HTML CODE”; statement.

thanks

Well, I’m not a Perl user, but this is how it’s done in PHP…

print <<<EOF
  text you want to show.
EOF;

It shouldn’t be too different from Perl. The way I learned this trick was from Invision Power Board, which was coded in PHP by a Perl programmer :wink:

I think the reason you are having troubles, is because of the “;” after “<<EOF” and NOT after “EOF”. You closed the function/statement before using it, which would throw an error, and where you closed the statement (the last “EOF”) you didn’t use a “;” to signify the end of the statement.

It’s been a while, but the perl syntax is as atari posted:

print <<EOF;
All my HTML code
EOF

Make sure “EOF” is on a line by itself with no preceeding or trailing spaces, tabs, etc.

print <<EOF;
All my HTML code
{space here}EOF

print <<EOF;
All my HTML code
EOF{space here}

print <<EOF;
All my HTML code
EOF # Prints out string…

All of the above will produce an error.

Thanks the response, but I am still receiving the error:
Can’t find string terminator “EOF” anywhere before EOF at c:\inetpub\wwwroot\samp\pst\loginlist.pl line 80.

Line 80 is: print <<EOF;
I made sure that there is nothing after EOF at the end of the list html code.

This is the code in the perl script, in a subroutine:
print start_html(‘Granted’);
print <<EOF;
<H3>Please take our survey!</H3>
<FORM ACTION=“/samp/pst/perlsurvey.pl” method=“post”>

	&lt;P&gt;&lt;STRONG&gt;Are you a Perl programmer? &lt;/STRONG&gt;&lt;BR&gt;
	&lt;INPUT TYPE="radio" NAME="perl" VALUE="yes"&gt;Yes&lt;BR&gt;
	&lt;INPUT TYPE="radio" NAME="perl" VALUE="no"&gt;No
	&lt;P&gt;&lt;STRONG&gt;Skill Level&lt;/STRONG&gt;&lt;BR&gt;
	&lt;INPUT TYPE="checkbox" NAME="excellent"&gt;Excellent&lt;BR&gt;
	&lt;INPUT TYPE="checkbox" NAME="good"&gt;Good&lt;BR&gt;
	&lt;INPUT TYPE="checkbox" NAME="low"&gt;Low&lt;BR&gt;
	&lt;INPUT TYPE="checkbox" NAME="not"&gt;I am not a Perl programmer
	&lt;P&gt;&lt;STRONG&gt;Gender: &lt;/STRONG&gt;&lt;BR&gt;
	&lt;INPUT TYPE="radio" NAME="sex" VALUE="male"&gt;Male&lt;BR&gt;
	&lt;INPUT TYPE="radio" NAME="sex" VALUE="female"&gt;Female
	
	&lt;P&gt;&lt;INPUT TYPE="submit" VALUE="Submit my Results"&gt;
	
	&lt;/FORM&gt;
	EOF
	print end_html;

Something strange is going on.
In a different perl script I have this, and it works perfect:

sub printtail {
print header;
print start_html(‘Thank you’);
print <<EOF;
<font size=“2”><b>·</b>
An HMTL file called <b>$fullname</b> of pictures was created.<br><br>
<font size=“2”><b>·</b>
The file, <strong>$fullname</strong>, is located in the following directory:<br>
  <strong>$path</strong><br>

EOF
print end_html;

If I comment out the EOF at the end, I get the error that I am receiving with the other script: Can’t find string terminator “EOF” anywhere before EOF