How to find out if X is an element in an array?

Try using the modern “smart match” operator:
if ( $tofind ~~ @in )

via How to find out if X is an element in an array?.

Had to do this for a script I’m writing where I need to compare two lists and find out which elements in list A aren’t in list B.   This was the simplest of all the solutions described in the above link.  I haven’t actually implemented this yet…

Update 12/19.  The above does indeed work.  Not sure how they do it.  It would seem comparing two lists of length n would be an O(n**2) problem.  Might have to look into a proper database however it’s still manageable at this scale.

Also, a shoutout to, a site that usually gets high rankings on my searches for perl related information and that is always concise and easy to read to  divine the info I was searching for.  The above link is a perfect example.  It points to a page that contains a lot of different implementations of what is probably a very common algorithmic problem.