#!/usr/bin/perl use warnings; use strict; use Test::More; my @checks = ( sub { my ($entity, @array) = @_; $entity ~~ @array; }, sub { my ($entity, @array) = @_; grep $entity eq $_, @array; }, sub { my ($entity, @array) = @_; for (@array) { return 1 if $entity eq $_; } return; }, ); for my $check (@checks) { ok $check->('b', qw(a b c)); ok not $check->('z', qw(a b c)); } done_testing();