I understand what's wrong here, I think, but I don't really know /why/. Simply:
my $foo= (my $bar = localtime)?("$bar hello"):("FAILED!");
Assuming you had some kind of code that you were checking for existance before formatting on one line, you get this:
Global symbol "$bar" requires explicit package name at ./scope.pl line
+ (whatever)
Why doesn't $bar propagate down to it's child conditions? This is bewildering because this works as expected:
print do { if(my $bar = localtime){ "$bar hello"}else{ "FAILED!" } };
I realize that the above construct probably isn't the internal representation of the ternary operator, but it is the logical expansion. If anyone has any additional info on what the perl internal structure on this is, I'd be happy to find out. Thanks
--
jaybonci