use warnings; use strict; my $myfruit = 'apples'; if (grep { $myfruit eq $_ } ("bananas","apples","oranges")){ print "I like $myfruit!"; } else { print "I don't like $myfruit!"; }
See also:
In reply to Re: IN-style operator for set of possible values
by toolic
in thread IN-style operator for set of possible values
by BeneSphinx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |