Surely, this is a question susceptible to just a little bit of experimentation:
>perl -wMstrict -le "my $which; my $s = 'foo' . $which ? 'bar' : 'baz' . 'boff'; ;; $s = 'foo' . ($which ? 'bar' : 'BAZ') . 'boff'; print qq{'$s'}; ;; $which = 1; $s = 'fee' . ($which ? 'FIE' : 'foe') . 'fum'; print qq{'$s'}; " Use of uninitialized value $which in concatenation (.) or string ... 'fooBAZboff' 'feeFIEfum'
In reply to Re: concat string with ternary operator
by AnomalousMonk
in thread concat string with ternary operator
by odrevet
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |