in reply to How to Do Multiple OR in For Loops
my $tp = grep { $myhash{ $_ } } @pred;
If the boolean needs to be formatted into '0' and '1' for output, that's the output code's job, and it can be done there trivially using « ? '1' : '0'».
Using "for", it would look like
ormy $tp = 0; for ( @pred ) { if ( $myhash{ $_ } ) { $tp = 1; last; } }
my $tp = 0; for ( @pred ) { last if $tp = $myhash{ $_ }; }
|
|---|