I'm sure there is a good reason why this works the way it does.
If I set a local variable inside a ternary operator like:
print ( my $foo = bar() ? $foo : "unknown" )
It works very closely to my expectations (which I'm sure are off). If bar returns any flavor of false, it will print the "unknown" value. And if bar return true it will call the correct part of the operation. But the local variable assignment will not be set so the output will be an empty string.
Anyone know why? Is this a scope thing?
P.S. Yes, I know there are other ways to do this with string printing. In my real world case, I have a much more delicate assignment and would like to cleanly assign and evaluate in one line. Plus I'm curious