Dennis Martin Ong:
# #!E:/perl/bin/perl
#
# print "Content-type:text/html\n\n";
# print <<EndHTML
# <html><head><title>Hello!</title></head>
# <body>
# <h2>Hello!</h2>
# Welcome, visitor from $ENV{'REMOTE_HOST'}!<p>
# </body></html>
# EndHTML
#
# It seems like I'd always get this error when there's a
# EndHTML in the script. What could the problem be? Is it due
# to a misconfiguration in Perl or rather the Apache?
Neither. It's a little misunderstanding of how Perl works. It's not an uncommon
mistake to make--I've been known to make it sometimes.
Basically, there's an invisible character at the end of your file called an EOF; it's
used to mark where the file ends. When you put a here-string into a Perl program,
perl looks for the text after the << *followed by a newline*. Since there's an EOF
character after the EndHTML instead of a newline, Perl doesn't recognize it.
The fix is to put a newline after the EndHTML. It may be easier to remember if you
put a 1; at the end of the script. That statement doesn't have any effect except to
force you to put a newline in.
--Brent Dax
[EMAIL PROTECTED]
Parrot Configure pumpking and regex hacker
Check out the Parrot FAQ: http://www.panix.com/~ziggy/parrot.html (no, it's not mine)
<obra> mmmm. hawt sysadmin chx0rs
<lathos> This is sad. I know of *a* hawt sysamin chx0r.
<obra> I know more than a few.
<lathos> obra: There are two? Are you sure it's not the same one?
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs