in reply to Re^3: given-when construct unexpected bahavior wit arrays
in thread given-when construct unexpected behavior with arrays
Yep, doing map {"_$_"} @array before each test, in given-when, is not good.
But grep works too much because if the first array element matches, you don't need to look others.This is probably the fastest solution :
sub is_in_array2 { my $element = shift; ($element eq $_) && return 1 for @_; }
update: You should also try with an hash %is_in_array
|
|---|