You've just found out that =~ is not a symmetrical relation, while == is. Other asymmetrical relations are <, >, <=, >=. Other symmetrical relations are != and eq. If you want to learn more on (symmetric) relations, see Symmetric relation.
Would it surprise you if a program that used $a < $b had output different from an otherwise identical program that used $b < $a?
| [reply] [d/l] [select] |
In program I you are checking if the regular expression /[abc][hij]/ matches the string " aj", which it does.
In program II you are checking if regular expression / aj/ matches the string "[abc][hij]", which it does not.
| [reply] [d/l] [select] |
jesuashok,
I believe one of the reasons you are getting downvoted for this post is that it sounds a lot like a number of your previous posts, wherein you ask what sounds to be either a complete beginner's Perl question, or a question that doesn't make any sense, and then say "why is this happening?!"
My question to you is this: by all accounts, you've been working as a Perl programmer for at least a couple of years. Is this really the first time you've come across regular expressions, or tried to understand how they work? And you were unable to search for any meaningful answers, and didn't have even a single colleague who could explain it to you? (Your junior, perhaps?)
And if you already understand regular expressions, why are you even bothering to ask the question in the first place??
Update: Doing a Super Search for text containing =~, and jesuashok as author, finds (among numerous others) this node, and this one.
[id://jesuashok|You] clearly understand how to use regular expressions. Please stop wasting others' time.
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
| [reply] [d/l] |
What the heck?
You're a fricking hermit here, you've posted 1700 times, and this is the best you can do?
Is this some sort of exercise in patience testing, because mine ran out with you some time ago. Anytime I see one of your posts, it's all I can do to stop myself immediately downvoting it.
If you can't think of anything to say, STOP POSTING. Please. I'm sure everyone would be helpful they felt a question was interesting or funny, or insightful. But this is just so much garbage. | [reply] |