in reply to Re: Re: (MeowChow) Re2: When does $_ get used?
in thread When does $_ get used?
No, at least part of your testing was flawed. "0 ", "0\n", "00", and even "0.0" are all true values. The only false values are "" and "0", period. Boolean context does not first convert the scalar to a number. undef is a special case of "" and numeric 0 is a special case "0" (or at least that is one way to think of it).
The real false values are "" and numeric 0 but "0" is also considered false because otherwise it would get really confusing. (: But there is no way for a numeric zero to get silently promoted to include a string value like "0 " or "0\n". Numeric zero always becomes simply "0", so we don't need to make any other strings false.
- tye (but my friends call me "Tye")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (tye)Re: Why isn't "0\n" false?
by John M. Dlugosz (Monsignor) on Jul 27, 2001 at 18:10 UTC | |
by tye (Sage) on Jul 27, 2001 at 19:17 UTC | |
by John M. Dlugosz (Monsignor) on Jul 27, 2001 at 19:54 UTC | |
by antivroom (Initiate) on Jul 27, 2001 at 20:05 UTC | |
by John M. Dlugosz (Monsignor) on Jul 27, 2001 at 22:35 UTC | |
by tye (Sage) on Jul 27, 2001 at 23:23 UTC |