I don't know the answer, but I just discovered that in
Perl 1, the result of the
== operator was
0 for false and 1 for true, instead of
""/1 as
it is now. So there must have been a conscious decision
to change it somewhere along the way. Why, I do not know.
I will post more information is I find out anything else.
Update: The change occurred in Perl 5.000. But it doesn't even
appear to be documented. (If someone does find that it is documented,
please let me know.)
Tye just pointed out that the
"" value is special.
Normally,
"" raises a warning if
you convert it to a number. But the
"" that results
from a comparison does not:
#!/bin/perl -w
$x1 = "" + 0;
$x2 = (1 == 0) + 0;
This generates an "isn't numeric" warning for line 2 but not line 3.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.