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]} }
For more general advice on how to refactor code like that, read Higher-Order Perl.
In reply to Re: Better way to write these checks?
by moritz
in thread Better way to write these checks?
by Ransom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |