Gossamer Forum
Home : General : Perl Programming :

newbie with simple question

Quote Reply
newbie with simple question
What's wrong with these I can't seem to get it to work?

#!/usr/local/bin/perl

# simple math calculation

$test = 6 + 3;

print "$test";

Thanks in Advance
Quote Reply
Re: newbie with simple question In reply to
It print's 9 for me?

Alex
Quote Reply
Re: newbie with simple question In reply to
I'm getting a 500 error and this message on my error log:

reason: malformed header from script. Bad header=9

Thanks in Advance
Quote Reply
Re: newbie with simple question In reply to
If this your full code then you are missing the following line which must be present before your first print statement (but only once):

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

Dan Smile
Quote Reply
Re: newbie with simple question In reply to
Thanks, the "content-type" statement was what I needed. Told you I was a newbie, hehe. Anyways, now on to the next phases of trial and error. I'm sure I'll be back asking how to fix simple problems like the above.

Thanks Again
Quote Reply
Re: newbie with simple question In reply to
Can I strongly suggest you learn perl before learning CGI? Go out and get Learning Perl by O'Reilly and Associates and go through the book. Download perl from http://www.activestate.com and work on your own computer, and try out examples.

Once you learn the syntax of the language, you will be able to pick up how CGI works much much easier.

Cheers,

Alex