I would use grep.
There are other ways see: List::Util#!/usr/bin/perl -w use strict; my @fruits = qw(banana plum apple strawberry pea); if ( grep {/apple/}@fruits ) #perhaps /^apple$/ { print "apple found!\n"; } else { print "apple not fouund\n"; } __END__ apple found!
In reply to Re: check if a value is in a given set
by Marshall
in thread check if a value is in a given set
by Ratazong
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |