Errin Larsen wrote:
Gunnar Hjalmarsson wrote:
Because the push() statement is in a loop, and my() would empty
the variable at each iteration.

push my @numbers, split while <>; foreach (sort { $a <=> $b } @numbers) { printf "%20g\n", $_; }

This code produces no output ... not even any warnings or errors.

Gunnar, I believe your explanation makes the most sense to me.  With
the my operator (function?) reseting the value of the @numbers
variable each time the loop is run, the output would not be in error,
it would just be empty.

So, now my question becomes, is there a way to watch this variable,
before, throughout and after the loop to confirm that it is being
reset each time.  More specifically, my problem now is, if the
variable is being reset throughout the loop, shouldn't the final
iteration of the loop have produced SOME output, albeit only the last
bits?

Yeah, I had the same thought. Suppose the fact that it doesn't contain the values from the last line proves that my theory is not the whole truth... See John's explanations.


--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to