use strict; sub in (@) { my $x = shift; $_ == $x and return 1 for @_; 0 } my $x = 10; if(in $x => 1 , 3, 7) { print "Found\n"; } else { print "Not found\n" }