Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Something I should be able to do, but I can't....

Status
Not open for further replies.

KingofSnake

Programmer
Jul 25, 2000
73
US
Someone help me out here.

This works just fine:
-----------------------------
#!/usr/bin/perl

print "Content-type:text/html\n\n";

print &quot;<html><head><title>Test Page</title></head>\n&quot;;
print &quot;<body>\n&quot;;
print &quot;<h2>Hello, world!</h2>\n&quot;;
print &quot;</body></html>\n&quot;;


But this doesn't:
-----------------------------
#!/usr/bin/perl

print &quot;Content-type:text/html\n\n&quot;;

print <<EndOfHTML;
<html><head><title>Test Page</title></head>
<body>
<h2>Goodbye, Cruel WORLD!</h2>
</body></html>

EndOfHTML
----------------------------

I don't understand it. This should work, shouldn't it? When running it through a perl exe, I get the following message:

&quot;Can't find string terminator &quot;EndOfHTML&quot; anywhere before EOF at c:\first.cgi line 5&quot;

When I run it on my website, I get a 500 Internal Server Error. What's going on?
KingOfSnake - The only sports drink with ice crystals
(and marshmellos!)
 
Nevermind! Hehe. I figured out the problem.

If I have EndOfHTML as the last thing in the cgi file, an error occurs. However, if I add

print &quot;</body></html>&quot;;

as the last thing of the file, it works fine.
KingOfSnake - The only sports drink with ice crystals
(and marshmellos!)
 
I believe that if you added an
Code:
exit;[code] after this you'd be fine.
 
The &quot;string terminator&quot; needs to be the only thing on a line, it needs to start in column 1, and it needs to have a carriage return (newline) after it. That last part may have been your problem. Adding the exit command would definitely solve it.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Hmm, isn't a semicolon required on the line immediately below the string terminator? e.g.:
[tt]
EndOfHTML
;
[/tt]

Derek
 
nope - The closing 'EndOfHTML' line just needs a new line char on the end. So, just hit return one more time.


keep the rudder amid ship and beware the odd typo
 
Alright. I tried out the blank line thing, and it worked. Thank you all that responded. I feel enlightened already.
KingOfSnake - The only sports drink with ice crystals
(and marshmellos!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top