in reply to (tye)Re: Why isn't "0\n" false?
in thread When does $_ get used?
Ah, I see.
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.
What am I doing wrong? It looks like "0 " is indeed false, while "0\n" is true.perl -e "print (0+qq(0 )?'true':'false')" perl -e "print (qq(0\n)?'true':'false')"
Update: I didn't notice I still had the 0+ in there. I tried a bunch of variations. That's what I get for experimenting at 2am!
—John
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re2: Why isn't "0\n" false?
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 |