Click to See Complete Forum and Search --> : Simple Question


jpmattis
05-18-2005, 02:37 PM
I am a total beginner, so please bare with me. I am trying to output some text to the screen based on whether or not the user entered a particualy value in the previous screen. I am testing this with an if statement. But I am getting a internal server error whenever I un-comment the print command. Any help, or ideas on how I might do this? Here is the code:

#This is a test to see whether they ordered from Hawaii
if ($shopdata{'STATETOSHIP'} eq "HI")
{

print <<"stop";

<p>your orders from Hawaii!</p>

stop
}

Thanks!

CyCo
05-18-2005, 04:26 PM
Maybe you forgot to print your header?

jpmattis
05-18-2005, 04:42 PM
Nope, that's not it.
Theoretically, shouldn't that code work?

CyCo
05-18-2005, 04:53 PM
...worked for me...maybe it's a newline issue

try this:

print qq`

<p>your orders from Hawaii!</p>

`;

digital_storm
05-19-2005, 02:50 AM
I dont know in which enviroment you are running but I had the same error running Linux when I didnt had set the rights correctly on the file.....

If you are running Unix Linux try:

chmod +x 'your file'

//D_S

jpmattis
05-19-2005, 12:50 PM
All the permissions are set right, I think I might have embedded that if statement in the wrong place...

I suppose the question is, that code is syntactically correct, right? It might just be a matter of where I placed it?

Thanks!

winged1
05-19-2005, 08:38 PM
print <<"stop";

should be;

print <<STOP;

content

STOP

The cap convention prevents accidental use of reserved phrases.

Jeff Mott
05-20-2005, 08:11 PM
The cap convention prevents accidental use of reserved phrases.There actually is no such convention in this case since reserved words do not affect here-docs. e.g.,print <<if;
Hello, World!
if


jpmattis, make sure there is no whitespace (spaces or tabs) on the same line as the terminating string.