How can I check if a Perl array contains a particular value?

Posted by Mel on Stack Overflow See other posts from Stack Overflow or by Mel
Published on 2010-05-18T19:03:31Z Indexed on 2010/05/20 2:30 UTC
Read the original article Hit count: 207

Filed under:
|
|

I am trying to figure out a way of checking for the existence of a value in an array without iterating through the array.

I am reading a file for a parameter. I have a long list of parameters I do not want to deal with. I placed these unwanted parameters in an array @badparams.

I want to read a new parameter and if it does not exist in @badparams, process it. If it does exist in @badparams, go to the next read.

© Stack Overflow or respective owner

Related posts about perl

Related posts about array