Well, we've been through this before, but if you're really worried about
having a "\n" at the end of your string, you can substitute a \Z for the $
in the regex.  It all depends on where the input comes from, and besides,
noone has been able to give an example of how this can come back to bite you
except in the example of forgetting to chomp your input.  If you can, then I
would seriously like to know.  Otherwise I'd just as soon use the $ instead
of explicitly entering in all \n's or stripping them every time I just want
to match a word at the end of a string.

-----Original Message-----
From: Bob Showalter [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 23, 2002 2:25 PM
To: 'Timothy Johnson'; Perl Beginners
Subject: RE: evaluating multiple conditions


> -----Original Message-----
> From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 23, 2002 5:11 PM
> To: 'Bob Showalter'; 'Shaun Fryer'; Perl Beginners
> Subject: RE: evaluating multiple conditions
> 
> 
> 
> Oops. I misread the last operator.  I should have written
> 
> if($something =~ /^(string0|string1)$/ || $something =~ /string2/){

Still not equivalent. What if $something contains "string1\n"?
That'll match your expression, but not the original version.

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

Reply via email to