On Tue, 19 Mar 2002, Kamali Muthukrishnan wrote:
> I have the following perl-script , which gives the user ( supposedly a
> first or second grader) a problem in addition or subtraction by
> generating random numbers. The random numbers generated are between 1
> and 10 for first graders and 10 and 100 for second graders. I am trying
> to just execute the code at the command prompt. It runs OK if the line
> -
>
> use CGI qw(:standard );
>
> is commented out. The loop goes through till I say 'n' to the query -
> do you want to continue ? If that line is not commented out ( I know it
> is not needed till I put a HTML piece to this ) it does not give an
> error, but runs wrong. Even if I pick 'Addition' as the operation I
> want, it gives me the subtraction problem (that is even if the
> expression in the if statement is true, it executes the 'else' ) and the
> loop does not go on till I say 'n'. Can somebody tell me why ?( I am a
> beginner)
Don't use CGI.pm unless you are really using it -- it expects certain
things to be coming in from STDIN (CGI parameters) and using it as an
interactive command-line program is going to do nothing but frustrate you.
It runs the subtraction block because the value retrieved from STDIN is
never assigned to the correct variable.
-- Brett
http://www.chapelperilous.net/
------------------------------------------------------------------------
The meek are contesting the will.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]