in reply to comarison synthax question
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 & .
|
|---|