use List::Util 'any'; # ......... if( any { $number4 == $_ } 1, 2 ) {...