$x = 3; $y = 7; @array = ( 0, 3, 7 ); if ( grep { $_ == $x } @array and grep { $_ == $y } @array ) { print "Good\n"; } else { print "Bad\n" }