go ahead... be a heretic | |
PerlMonks |
Re: comarison synthax questionby bobf (Monsignor) |
on Apr 11, 2007 at 20:41 UTC ( [id://609470]=note: print w/replies, xml ) | Need Help?? |
It is most definitely not doing what you think it is. & is the bitwise string operator (see perlop). If you want a logical comparison, you need to use and or && (just be aware of the difference in precedence between the two; again, see perlop). To test both variables against the regex, you need to test each of them individually. As an aside, if you didn't need the case insensitivity you could use index. I think you'll get the results you desire if you fix your second example to use && instead of & .
In Section
Seekers of Perl Wisdom
|
|