in reply to concat string with ternary operator
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'
|
|---|