Paul Rogers wrote:
> What's the simplest/shortest way to write an IF statement given that I'm
> looking for the variable to be one of 5 possible choices?
>
> E.g.,
>
> if ($x eq 'a' or $x eq 'b' or $x eq 'c or $x eq 'd' or $x eq 'e') {
> blah
> }
>
> I guess what I'm asking for is if there is a way to simplify/shorten this
> structure?
You could use a RE, but it may be slower :
if ($x =~ /^[abcde]$/) {
code
if the characters were words :
if ($x =~ /^(word1|word2|word3|word4)$/) {
code
> I was thinking along the lines of using logical ORs but I couldn't figure
> out a way to do it.
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs