laziness, impatience, and hubris | |
PerlMonks |
my behavior with "NULL" declarationsby dsb (Chaplain) |
on Jul 08, 2004 at 17:38 UTC ( [id://372873]=perlquestion: print w/replies, xml ) | Need Help?? |
dsb has asked for the wisdom of the Perl Monks concerning the following question:
No, this is not an opportunity for everyone to evaluate my behavior. It's my's behavior that is under the microscope here.
All bad jokes aside, I was playing around with the trinary operator and was trying to do what I guess you could dynamic variable declaration. For what purpose? I don't know. I just wanted to see if I could do it. Basically what I was trying to do was: So whether or not there is an argument to the script would decide which variable, $foo or $bar, would be declared. It works fine as is. But if I try to declare with my while using strict, everything falls apart and I get an error. So I suppose a null operation is one in which no value is returned, which makes sense because why would you use my to declare nothing. So I'm wondering why this is considered a null operation. The trinary should return one value or the other, in the case either $foo or $bar. The only thing I could think of is that b/c strict is in effect, $foo and $bar do not are evaluated before being declared with my and so technically don't exist. But then I wondered why that didn't through a Global symbol error. And besides that, my behaves the same way and throws the same error whether I use strict or not. Anyway, I'm at a loss. Any ideas?
dsb This is my cool %SIG
Back to
Seekers of Perl Wisdom
|
|