A my declaration does not take effect until the end of a statement - a semicolon or end of block (which won't do you much good, since the var will go out of scope immediately). You'll need to split that into two statements:
my $bar = localtime; my $foo= ($bar)?("$bar hello"):("FAILED!");
After Compline,
Zaxo
In reply to Re: Variable scope in ternary ?: operator not propagating?
by Zaxo
in thread Variable scope in ternary ?: operator not propagating?
by JayBonci
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |