use List::Util 'first'; my @arr = (1..2, 0, 4); my $num = 0; defined first {$_==$num} @arr and print 'found';