in reply to Re: check if an element exists in array
in thread check if an element exists in array
sub isInList { my( $d, $it ) = ( "\0", @_ ); join( $d, '', @_, '' ) =~ /$d\Q$it\E$d/ }
Caveat: This treats all the values as strings. Input values which are not strings will get stringified! This may or may not yield the desired results.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: check if an element exists in array
by RecursionBane (Beadle) on Apr 13, 2011 at 18:13 UTC | |
by jdporter (Paladin) on Apr 13, 2011 at 18:42 UTC |