in reply to Better way to write these checks?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Better way to write these checks?
by Ransom (Beadle) on Jun 29, 2012 at 12:44 UTC | |
|
Re^2: Better way to write these checks?
by Anonymous Monk on Jun 29, 2012 at 12:50 UTC |