|Do you know where your variables are?|
use strict, strange behavior with single character variablesby johnny_carlos (Scribe)
|on May 09, 2002 at 22:09 UTC||Need Help??|
johnny_carlos has asked for the
wisdom of the Perl Monks concerning the following question:
I've been pulling my hair out for quite a while(more time than I want to admit) trying to figure out why this:
actually prints "1", when it *thought* it should give a compile-time error for not declaring $a. I felt as though I had witnessed the impossibe. For a while there I was questioning my entire existence, and my world was about to collapse since everything I've ever known to be real and true suddenly was not.
I still don't know what the problem is, but my fears were alleviated when I expanded my minimalist test case to this:
...and this works like it should, dying a horrible, miserable death.
So whats the deal? Anyone know why single character variable names slip through the cracks under the use strict pragma?? Or am I not seeing something?