http://www.perlmonks.org?node_id=11144189


in reply to Re^3: Purpose of =~ and = in this statement
in thread Purpose of =~ and = in this statement

"zero but true"

"0 but true"

Replies are listed 'Best First'.
Re^5: Purpose of =~ and = in this statement
by Marshall (Canon) on May 26, 2022 at 22:33 UTC
    Thanks for the correction, my memory was fuzzy.

    I think that this string "0 but true" is a very ancient artifact dating from before scientific notation. I have never seen this in my coding. I have however encountered "0E0" with the DBI as the normal, standard way to say "statement worked correctly, but produced a zero result", true in a logical comparison sense, but numeric zero in a numeric sense.

      "0 but true" is the self-documenting way to have a zero value evaluating to true, "0E0" is the clever but not so obvious one.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        I am not the judge or the author of either one of these variations. I simply report that 0E0 is in current use.