in reply to Re: Useless <c>unless</c>
in thread Useless unless

Can't use the ternary operator where the if/unless/otherwise is being used as a modifier.

Any negated statement requires one more step of mental processing and it seems to take an extra step with unless to realise that it is negating the condition. The trap is simply that it is unless rather than if.


Perl is Huffman encoded by design.

Replies are listed 'Best First'.
Re^3: Useless <c>unless</c>
by davidrw (Prior) on Aug 05, 2005 at 23:25 UTC
    Can't use the ternary operator where the if/unless/otherwise is being used as a modifier.
    modifier? do you mean assignment like my $x = $A ? $B : $C; ?
    The trap is simply that it is unless rather than if.
    How is that different a statement being !$x rather than $x and just missing/misreading the 'bang'?