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

Re: Comparing to many possibles

Thread Previous
From:
bob ackerman
Date:
March 4, 2002 10:10
Subject:
Re: Comparing to many possibles
Message ID:
1268AA30-2F9B-11D6-A414-003065428126@pacbell.net
$x='y';
if($x=~/[xyz]/)     # checks for match to any character in set
{
	print 'yes';
}
else
{
	print 'no';
}

On Monday, March 4, 2002, at 11:33  AM, Dennis G. Wicks wrote:

> 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
>


Thread Previous


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