use List::MoreUtils qw/any/; sub is_in_num { my $matcher = shift; any { $matcher == $_} @{$_[0]} } sub is_in_str { my $matcher = shift; any { $matcher eq $_} @{$_[0]} }