develooper Front page | perl.beginners | Postings from March 2002

RE: Comparing to many possibles

Thread Previous | Thread Next
From:
Timothy Johnson
Date:
March 4, 2002 10:03
Subject:
RE: Comparing to many possibles
Message ID:
C0FD5BECE2F0C84EAA97D7300A500D5002581027@SMILEY
You can do it with a regex:

if($x =~ /^[XYZ]$/){
   do something...
}

or 

if($x =~ /^(X|Y|Z)$/){
   do something...
}


-----Original Message-----
From: Dennis G. Wicks [mailto:wix@eskimo.com]
Sent: Monday, March 04, 2002 11:34 AM
To: beginners@perl.org
Subject: Comparing to many possibles


Greetings;

Is there some perl shorthand that will make it easier to say

	if ( $x eq 'X' || $x eq 'Y' || $x eq 'Z' )

TIA,
Dennis

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org



--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About