> -----Original Message----- > From: Tara Calishain [mailto:[EMAIL PROTECTED]] > Sent: Sunday, July 28, 2002 5:28 PM > To: [EMAIL PROTECTED] > Subject: comparing to everything in an array? > > > Gentle Perl people, > > Sorry to bother you with this, but I can't find the answer in > my Pile of > Perl Books. > I probably don't know enough to ask the question correctly. > > I know you can compare two variables: > > if ($foo eq $otherfoo) {things happen} > > What I want to know is if you can do something that compares > a variable to > every element > in an array. For example, would something like > > if ($foo eq @fooarray) {things happen} > > work? > > I'm trying to say, "If the variable $foo equals any element > in the array > @fooarray things > happen."
You should also peruse the FAQ article: perldoc -q 'How can I tell whether a list or array contains a certain element?' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]