in reply to Re^2: foreach loop - could it beeeeee!!
in thread foreach loop - could it beeeeee!!
Surely ‘should’ (instead of ‘could’) is a bit strong?
I don't think so. Anything but the trivial use of the conditional operator is usually unreadable. The OP's code is definitely unreadable. Part of the reason his code is unreadable is due to his non-standard and verbose use of the conditional operator.
it's easy on a quick read to bracket a
I usually add parens around the conditional operator for similar reasons:
my $pick = ( $choice_array[0] eq 'correct' ? aaa : bbb );
my $pick = ( $choice_array[0] eq 'correct' ? aaaaaaaaaaaaaaaaaaaaaaaaaaa : bbbbbbbbbbbbbbbbbbbbbbbbbbb );
|
|---|