Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: comarison synthax question

by bobf (Monsignor)
on Apr 11, 2007 at 20:41 UTC ( [id://609470]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://609470]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-18 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found