I still am not convinced that all of the hoopla about \z is really
necessary.  I guess the question I need answered before I go back and change
anything is this:  How is the user supposed to enter an extra \n without
exiting the prompt?  What I mean is, the only situation in which this could
make a difference is if you concede that a user can somehow enter a \n
character into a prompt without returning that value back to your script.
Otherwise it's your fault if you don't chomp their response.

  There's a distinct possibility that I'm wrong here, but I haven't heard
any really good arguments on this.

-----Original Message-----
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 1:07 PM
To: Dennis G. Wicks
Cc: [EMAIL PROTECTED]
Subject: Re: Comparing to many possibles


On Mar 4, Dennis G. Wicks said:

>Is there some perl shorthand that will make it easier to say
>
>       if ( $x eq 'X' || $x eq 'Y' || $x eq 'Z' )

You can use

  if ($x =~ /^(?:X|Y|Z)\z/) { ... }

I side with Randal in warning about the use of $ here where \z is clearly
the proper choice.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to