Click to See Complete Forum and Search --> : Help with code.


viZi0n
09-23-2004, 07:23 PM
i am new to cgi and was wondering if anyone could help me with this code.

#!/usr/local/bin/perl -wT
use strict;
my ($sales_Jan, $sales_Feb, $sales_Mar,
$sum_1Q, $label_1Q);

$sales_Jan = 5467;
$sales_Feb = 234;
$sales_Mar = 8875;
$sum_1Q = $sales_Jan + $sales_Feb +
$sales_Mar;
$label_1Q = 'first quarter';

print "Content-type: text/html\n\n";
print "Sales for the $label_1Q were
$sum_1Q";

CyCo
09-24-2004, 09:22 AM
Your script seems OK to me. What problem are you having? It outputs:

Sales for the first quarter were 14576

...just as one would expect.

viZi0n
09-24-2004, 09:24 AM
i get internal server error. and i know i have my permissions on execute.

CyCo
09-24-2004, 09:39 AM
Is the path to perl correct?

#!/usr/local/bin/perl -wT

viZi0n
09-24-2004, 09:41 AM
yes

CyCo
09-24-2004, 09:47 AM
...try removing the "T"...

#!/usr/local/bin/perl -w

depending on your server configuration, some hosts don't allow the "taint" switch

viZi0n
09-24-2004, 10:08 AM
that didnt work either....im going to ask my teacher to look at it.

CyCo
09-24-2004, 10:19 AM
Well, as long as you uploaded the script in ASCII mode, set the permissions to 755 and have the correct path to perl, it should be fine...