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.((shift @ARGV) ? $foo : $bar) = "Hello";
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.use strict; my ((shift @ARGV) ? $foo : $bar) = "Hello"; # Can't declare null operation in "my" at trinary.pl...
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?
In reply to my behavior with "NULL" declarations by dsb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |