Tara, Try this: foreach $elemenet(@fooarray){ if($element eq $foo){ things_happen; } } - John
On Sun, 28 Jul 2002, Tara Calishain wrote: > 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." > > Thanks, > > Tara > [EMAIL PROTECTED] > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]