Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

need help please
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  boo
k
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?





Report this thread to moderator Post Follow-up to this message
Old Post
HOTFUNINTHACITY@aol.com
04-25-05 08:56 AM


Re: need help please
HOTFUNINTHACITY@aol.com wrote:
> 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  b
ook
> 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

Report this thread to moderator Post Follow-up to this message
Old Post
Keith Worthington
04-25-05 08:56 AM


RE: need help please
HOTFUNINTHACITY@aol.com <mailto:HOTFUNINTHACITY@aol.com> wrote:

: 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>

That doesn't look right. Is that edited? There shouldn't be a
line 00. And "multiplication" is spelled wrong in one error message.
Show us the unedited error messages or tell us that you edited
things. Leaving out key details is a Bad Thing.


: 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?

It's an error in the program you wrote. We don't know if it is
also in your text book without a comparison. Does your teacher
allow you to get help from email lists?

HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328


Report this thread to moderator Post Follow-up to this message
Old Post
Charles K. Clarkson
04-25-05 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:22 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.