Hi
My program is to send data using an online form.
I have the web page for the form. But the web page does not receive the data from the cgi file.
I check my work in DOS. When I type perl -c bonus.cgi I get a message tell me syntax ok.
But when I check with : perl -w bonus.cgi I get this under <BODY>:
Use of uninitialized value in multiplication <*> at -----.cgi line 00
Your bonus is $0.00<BR><BR>
You entered a sales amount of $0.00 and a
Use of uninitialized value in muliplycation <*> at ----.cgi line 00
bonus rate of 0.00<BR>
this is the body part as shown in my chapter of my college course study book in the -----.cgi file..
printf "Your bonus is \$%.2f.<BR><BR>\n", $bonus;
printf "You entered a sales amount of \$%.2f and a \n", $sales;
printf "bonus rate of %.1f%%.<BR>\n", $rate * 100;
Is this a error in my book or a bug in my Perl program?
I am a newbie myself but if I were in your situation this is what I would check/try.
Do you have "use strict;" and "use warnings;" at the beginning of your code?
Where are $bonus and $rate defined?
The error message indicates that there is a problem with the multiplication on the first line but I do not see any multiplication in the code that you provided.
The lack of error message regarding $sales and the assumption that $bonus = $sales * $rate; leads me to believe that $rate didn't get set somewhere.
Put something like my ($bonus, $sales, $rate) = (10.00, 100.00, 0.10); print " Bonus: $bonus\n"; print " Bonus: $sales\n"; print " Bonus: $rate\n"; Before the section you provided.
If the error goes away remove the first line and try again. Admittedly that is a brutally simple debugging technique but it may help.
HTH -- Kind Regards, Keith
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>