Thank you all for you prompt and accurate help. I will not soon forget the
difference between assigning a value and a numeric comparison operator.
Jason, with the "@a=$number" statement, I was trying to create the list by
changing contexts. In other words, if returns the input in a scaler
cont
On Jan 31, Rambog said:
>I am attempting a program that reads a list of numbers from the screen until
>the number 999 is read. It then prints the sum of all numbers read- with
>the exception of the 999.
>
>My code looks like:
>
>until ($number=999) {
You want ==, not = here.
>print "Please inp
6:10
To: [EMAIL PROTECTED]
Subject: Debug some simple code
I am attempting a program that reads a list of numbers from the screen until
the number 999 is read. It then prints the sum of all numbers read- with
the exception of the 999.
My code looks like:
until ($number=999) {
print "Pleas
AIL PROTECTED]]
Sent: Thursday, January 31, 2002 11:10 AM
To: [EMAIL PROTECTED]
Subject: Debug some simple code
I am attempting a program that reads a list of numbers from the screen until
the number 999 is read. It then prints the sum of all numbers read- with
the exception of the 999.
My code looks l
At 11:09 AM 1/31/2002 -0500, you wrote:
>I am attempting a program that reads a list of numbers from the screen until
>the number 999 is read. It then prints the sum of all numbers read- with
>the exception of the 999.
>
>My code looks like:
>
>until ($number=999) {
>print "Please input your numb
A couple of things here ...
1) Watch out for = vs. == ... very tricky! Your first until loop won't even
eval b/c $number=999 is always true.
2) @a=$number; is not what you want... I'm not even sure what that does. You
probably want to use the push function, like so:
push @a, $number
I am attempting a program that reads a list of numbers from the screen until
the number 999 is read. It then prints the sum of all numbers read- with
the exception of the 999.
My code looks like:
until ($number=999) {
print "Please input your number:\n";
chomp($number=);
@a=$number;
}
foreach $