http://qs1969.pair.com?node_id=1218673


in reply to IF condition with a range

Another approach if you want exact integer match. Not that much shorter but flexible for bigger range or more matches. See also Syntax::Keyword::Junction for more terse.

use List::Util 'any'; if (any {$x == $_} $y, $y +1, $y -1)
Ron