|
|
| The stupid question is the question not asked | |
| PerlMonks |
Scoping Variablesby stuffy (Monk) |
| on May 17, 2001 at 09:52 UTC ( [id://81192]=perlquestion: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.stuffy has asked for the wisdom of the Perl Monks concerning the following question:
I'm going to make some assumptions from things I've read in Programming perl, and in the monastary
Please correct me if I'm wrong: this works as planned, every time the program runs across the date, it is output on the screen. I'm assuming that $date is scoped in the while loop the next part:
this is where I don't think things are working correctly. the ouput is not exactly what I am expecting. I am getting "the date is..." and that's it. I am assuming that since $date is scoped within the while loop, it therefore should work in the if loop since the if loop is contained in the while. I am expecting to see "the date is Sun Oct 23". I have also tried:
just to scope it in the subroutine rather then in the loop, but that has the same results. I'm somewhat confused about what is going on here. Stuffy
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||||||||