There are some special case true/false situations!
(1) In Perl, the string: "0 but true" is an exception. This string will evaluate to a numeric 0, but a logical true! The logical "true" is not surprising, but the numeric 0 is! That is because this is a special case coded into Perl. Even under use strict; use warnings;, "0 but true" can be used in a numeric expression/computation.
my $x = "0 but true";
print $x + 1; #prints 1!!!
my $xx = "1 but true";
# print $xx +1; #Ooops ERROR!
(2) There is a more "modern way" of returning the "0 but true" value. That is the string "0E0". The DBI will return this to mean: "hey, I worked!, but I modified zero rows". 10**0 is one. So 0*10**0=0*1=0. So this enables the conveyance of (a)I worked (no error) and (b)result is zero within a single string value "0E0".
I have not seen recent code with the case (1) above. But I have verified that it does indeed work. You don't have to get too far into the DBI before you encounter (2) like when you are updating a table - the table update was just fine "true", but it just didn't do anything (rows modified = 0).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||