|Perl: the Markov chain saw|
Re: Re^4: m//g behaves strange... (!1)by pg (Canon)
|on Nov 10, 2003 at 06:27 UTC||Need Help??|
Yes, I know what you said. If this is the logical answer, so simple and straight, I have used it in my previous post already. Does not seem to me that you have read and understood my previous post carefully. What you said is right, but it does not mean anything here.
Also I don't understand why you involve !1, when you can simply state that both 0 and "" are "false". How is this "!" operator get involved, when we are talking about "~" operator. They are relatives, but not the same person.
Although Perl consider multiple values as "false", for a particular function, it usually always returns a single fixed consistent value to represent "false". Ask you an extream question, both 1 and 2 represents "true", when one of your function needs to return "true", will you consistently return 1, or will you sometime return 1 and sometime return 2?
You failed to answer why should "~" receive 0, when "~" can be applied against "empty string" with no problem, and as we see thru lots of my demo, m// actually returns "empty string" from time to time to represent "false".
Your 0+"" example also means nothing here. In your case, "+" operator has to be applied to numbers, but in my case, it is absolutely valid to use "~" operator against a string. try this:
From a logic point of view, what you did is like: I asked how much 1+1 is, and you answered 2+3=5.
Anonymous Monk's dump is useful, and my further explanation is that:
One reminder, the dump you given shows ""\0, please don't make up this !1. State what you observed, and only what you observed.