in reply to How to Do Multiple OR in For Loops

Untested:
my $tp = 0; my @allpreds = ($pred,$pred1,$pred2,$pred3,$pred4,$pred5,$pred6); foreach my $allpred ( @allpreds ) { if ( $myhash{$allpred} ) { $tp = 1; last; } } my $fp = ($tp == 1) ? 0 : 1;

Replies are listed 'Best First'.
Re^2: How to Do Multiple OR in For Loops
by Anonymous Monk on Apr 13, 2011 at 01:55 UTC
      !!!$tp is the same as just !$tp, and it's not equivalent to $tp ? 0 : 1.
      $ perl -E'$tp=1; say "[", !$tp, "]";' [] $ perl -E'$tp=1; say "[", $tp ? 0 : 1, "]";' [0]
        !!!$tp is the same as just !$tp,

        Except that it isn't, and you know this

        and it's not equivalent to $tp ? 0 : 1

        So?