To avoid a temporary variable:
if( sub{ $_ == $wanted and return 1 for @ary; 0 }->() ) { say "match" +}
In reply to Re^3: Shortcutting grep in boolean context
by tybalt89
in thread Shortcutting grep in boolean context
by perlancar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |