This is almost exactly what you've asked for, but less typing:
if( $myfruit =~ m[bananas|apples|oranges] ){ print "I like $myfruit!"; } else { print "I don't like $myfruit!"; }
To be absolutely certain, you could use: m[^(?:bananas|apples|oranges)$]
In reply to Re: IN-style operator for set of possible values
by BrowserUk
in thread IN-style operator for set of possible values
by BeneSphinx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |