|Keep It Simple, Stupid|
Scoping Variablesby stuffy (Monk)
|on May 17, 2001 at 13:52 UTC||Need Help??|
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.