Ah yes, this is a nice idiom, and to use it in an expression, one can use e.g. do:
if (do { my $found; $_ == $wanted and $found = 1 and last for @ary; $found }) { say "match" }'
In reply to Re^2: Shortcutting grep in boolean context
by perlancar
in thread Shortcutting grep in boolean context
by perlancar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |